Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/githubuseraccountamazing/shortscript
Copy selected code and automatically remove comments, blank lines, and leading/trailing spaces from a selected code snippet. Useful for pasting lots of code into AI prompts. (AHK and Bash version)
https://github.com/githubuseraccountamazing/shortscript
autohotkey bash bash-script bing-ai binggpt chatgpt code-snippets edgegpt prompt-engineering shell shell-script shorten shortener shortener-service
Last synced: 1 day ago
JSON representation
Copy selected code and automatically remove comments, blank lines, and leading/trailing spaces from a selected code snippet. Useful for pasting lots of code into AI prompts. (AHK and Bash version)
- Host: GitHub
- URL: https://github.com/githubuseraccountamazing/shortscript
- Owner: GithubUserAccountAmazing
- License: gpl-3.0
- Created: 2023-04-28T02:49:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-25T19:45:04.000Z (over 1 year ago)
- Last Synced: 2024-09-11T19:51:31.114Z (2 months ago)
- Topics: autohotkey, bash, bash-script, bing-ai, binggpt, chatgpt, code-snippets, edgegpt, prompt-engineering, shell, shell-script, shorten, shortener, shortener-service
- Language: AutoHotkey
- Homepage:
- Size: 79.1 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ShortScript:sparkles:
####
A tool to optimize code snippets for AI prompting.
ShortScript is a simple and handy tool that helps you copy and paste code for using it within AI prompts.
- It minifies your selected code by removing comments, blank lines, and spaces. This reduces the size of your code and makes it easier to copy and paste into AI applications like ChatGPT or Bing AI.
- It wraps your selected code with codeblock syntax (triple backticks) to help make your prompt clearer and easier for the AI to understand.For example, this is how ShortScript transforms a basic JavaScript code that uses comments, blank lines, and good formatting:
## Why Use This?
AI apps need prompts to generate output. Prompts have a character limit based on the app and the language model. For example, ChatGPT can process up to 500 words or 4,000 characters. If you go over the limit, the app may stop working or show an error. ShortScript can help you optimize your code for AI prompting by making it shorter and clearer. This can prevent character limit issues and improve AI output.
## How to Set Up
Windows -> AHK:
- Install AutoHotkey on your system.
- Run the script by double-clicking or right-clicking on the .ahk file.Linux -> Bash:
- Install dependency xclip with "sudo apt-get install xclip"
- Add the path to ShortScript.sh as a custom key binding## How to Use
- Select a JavaScript/Python code with your mouse or keyboard and press Win+C to copy a shortened and wrapped version to your clipboard.
- Paste the shortened and wrapped code wherever you want.## Features and Limitations
- There seems to be an issue with using the bash script to extract text from CodeMirror editors.
- The script is optimized for JavaScript, Python which use "//" and "#" as comment symbols.
- Subtle differences in functionality may emerge between the AHK and Bash versions as the project progresses.If you encounter any issues or have suggestions for enhancements, please feel free to submit an issue or pull request.
## Disclaimer
This script is provided "as is" without any warranty. The author is not responsible for any damage or loss caused by using this script. See License for more info.