Bash / Shell is one of the last things I would trust a typical AI considering how much bad shell code/examples exist out there. (it always surprise me how many unquoted variables exist in most shell scripts; quoting fixes many problems, doesn't hurt and still developers are often to lazy to do it) The example in the project readme is imo already a bad example. $ ai ask "Check process running on port" Answer Command i…
Show HN: Get answers for shell commands from GPT3 from your terminal
41–50 of 97 posts
Re: Show HN: Get answers for shell commands from GPT3 from your terminal
#42Bash / Shell is one of the last things I would trust a typical AI considering how much bad shell code/examples exist out there. (it always surprise me how many unquoted variables exist in most shell scripts; quoting fixes many problems, doesn't hurt and still developers are often to lazy to do it) The example in the project readme is imo already a bad example. $ ai ask "Check process running on port" Answer Command i…
> 'Correctly answer the asked question. Return \'Sorry, Can\'t answer that.\' if the question isn\'t related to technology.\n\nQ - get into a docker container.\nA - `docker exec -it mongodb`\n\nQ - Check what\'s listening on a port.\nA - `lsof -i tcp:4000`\n\nQ - How to ssh into a server with a specific file.\nA - `ssh -i ~/.ssh/id_rsa user@127.0.0.1`\n\nQ - How to set relative line numbers in vim.\nA - `:set relativenumber`\n\nQ - How to create alias?\nA - `alias my_command="my_real_command"`\n\nQ - Tail docker logs.\nA - `docker logs -f mongodb`\n\nQ - Forward port in kubectl.\nA - `kubectl port-forward 8080:3000`\n\nQ - Check if a port is accessible.\nA - `nc -vz host port`\n\nQ - Reverse SSH Tunnel Syntax.\nA - `ssh -R :: @`\n\nQ - Kill a process running on port 3000.\nA - `lsof -ti tcp:3000 | xargs kill`\n\nQ - Backup database from a mongodb container.\nA - `docker exec -it mongodb bash -c "mongoexport --db mongodb --collection collections --outdir backup"`\n\nQ - SSH Tunnel Remote Host port into a local port.\nA - `ssh -L :: @`\n\nQ - Copy local file to S3.\nA - `aws s3 cp s3:///`\n\nQ - Copy S3 file to local.\nA - `aws s3 cp s3:/// `\n\nQ - Recursively remove a folder.\nA - `rm -rf `\n\nQ - Copy a file from local to ssh server.\nA - ` scp /path/to/file user@server:/path/to/destination`\n\nQ - Curl syntax with port.\nA - `curl http://localhost:3000`\n\nQ - Download a file from a URL with curl.\nA - `curl -o `\n\nQ - Git commit with message.\nA - `git commit -m "my commit message"`\n\nQ - Give a user sudo permissions.\nA - `sudo usermod -aG sudo `\n\nQ - Check what\'s running on a port?\nA - `lsof -i tcp:`\n\nQ - View last 5 files from history\nA - `history | tail -5`\n\nQ - When was China founded?\nA - Sorry, Can\'t answer that.\n\nQ - Pass auth header with curl\nA - `curl -H "Authorization: Bearer " `\n\nQ - Filter docker container with labels\nA - `docker ps --filter "label="`\n\nQ - When was Abraham Lincon born?\nA - Sorry, Can\'t answer that.\n\nQ - Get into a running kubernetes pod\nA - `kubectl exec -it bash`\n\nQ - Capital city of Ukrain?\nA - Sorry, Can\'t answer that.\n\nQ - ';
so you would expect it to answer it "correctly"
Re: Show HN: Get answers for shell commands from GPT3 from your terminal
#43Earlier quoted context omitted.
I sort of agree wrt quoting. Most people's solution is just "well don't use spaces or dollars or whatever in your filenames!" which is obviously shit. But on the other hand I think the ultimate blame lies with Bash for being so shitily designed that you can make basic quoting mistakes and it works most of the time. Real programming languages don't have that issue.
It's not a real programming language tho
Re: Show HN: Get answers for shell commands from GPT3 from your terminal
#44Re: Show HN: Get answers for shell commands from GPT3 from your terminal
#45Re: Show HN: Get answers for shell commands from GPT3 from your terminal
#46Earlier quoted context omitted.
I sort of agree wrt quoting. Most people's solution is just "well don't use spaces or dollars or whatever in your filenames!" which is obviously shit. But on the other hand I think the ultimate blame lies with Bash for being so shitily designed that you can make basic quoting mistakes and it works most of the time. Real programming languages don't have that issue.
It's not a real programming language tho
Re: Show HN: Get answers for shell commands from GPT3 from your terminal
#47Bash / Shell is one of the last things I would trust a typical AI considering how much bad shell code/examples exist out there. (it always surprise me how many unquoted variables exist in most shell scripts; quoting fixes many problems, doesn't hurt and still developers are often to lazy to do it) The example in the project readme is imo already a bad example. $ ai ask "Check process running on port" Answer Command i…
Re: Show HN: Get answers for shell commands from GPT3 from your terminal
#48Serious question. Why npm? I mean it's a command line tool; why buy in to the JavaScript ecosystem?
The code is open-sourced please feel free to raise a PR. https://github.com/abhagsain/ai-cli
Re: Show HN: Get answers for shell commands from GPT3 from your terminal
#49I wrote something similar, but as a terminal emulator: https://github.com/jjviana/witty
Re: Show HN: Get answers for shell commands from GPT3 from your terminal
#50Bash / Shell is one of the last things I would trust a typical AI considering how much bad shell code/examples exist out there. (it always surprise me how many unquoted variables exist in most shell scripts; quoting fixes many problems, doesn't hurt and still developers are often to lazy to do it) The example in the project readme is imo already a bad example. $ ai ask "Check process running on port" Answer Command i…
It's not clear to me that this tool is a win over that method.