Live data from Hacker News

Show HN: Get answers for shell commands from GPT3 from your terminal

github.com

31–40 of 97 posts

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#31
Here is my 5 line bash script which uses Fabrice Bellard's https://textsynth.com

You need to sign up (with email address only) for an API key. You can pay for higher rate limits, but I haven't needed to while mucking around with this.

     #!/bin/bash
     
     # Make an account at https://textsynth.com/ get API key and put it in below
     
     curl -s https://api.textsynth.com/v1/engines/gptneox_20B/completions \
         -H "Content-Type: application/json" \
         -H "Authorization: Bearer YOURAPIKEYGOESHERE" \
         -d '{"prompt": "Using the Linux shell\n\nQ: how do I '"$*"'?\nA: ", "max_tokens": 200, "temperature":1.0 }' | jq -r .text
Gives for example

    $ ai check process running on port

    If you are looking for processes listening on port 80 or some other port, you can use netstat command with the port number:
    netstat -tupln | grep 80

    For more details please refer https://serverfault.com/a/538945/192371

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#32

On one hand I can see how this would be incredibly useful (I can never remember what ffmpeg flags I need) but I also just,,,,, I have this immediate uncomfortable reaction to the thought of just piping AI output into the terminal with the express purpose of not needing to know what the flags do. If the AI makes a mistake and the only way to catch it is to know what the flags do anyways, I think this becomes less usef…

I'd be worried about the same thing, and wouldn't execute blindly. It seems like a useful way to quickly find out which flags you should be checking the man pages for.

this makes me think of a really great developer I worked with one time who had one major failing, he was too trusting.

So one time he got some code from the senior backend Java developer in Argentina and went to past it into the place he was told to paste it into for sending alert notifications to customers, some months later we are going through a major crisis because alerts have not been working for several months and all the customers who are paying thousands per month for the service are getting pissed.

He worked home a day he could really focus on debugging and finding what could possibly have caused our systems to fail!

I was done with some little task I was on and decided to look through code changes and it really stood out the code he had pasted because if it worked that would mean Java was some magic language with incredibly terse code.

So later on we were having a major emergency call to figure out what could possibly be causing this extremely serious major bug and I said well I was looking through the code and you could see him manfully controlling his exasperation because hey, Bryan is not a Java guy and there is zero chance I could have a meaningful contribution to the current problem.

But yes it turned out he had trustingly pasted in code that we all agreed would never have worked (without caring to basically even read it), which despite the fact that in many ways this guy was better than me is something I would never, ever have done because I am a really hyper-paranoid guy about trusting code.

Anyway tldr, I would never use this tool but maybe some really skillful people would because they don't have the paranoid mindset.

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#34
I like the idea, like other people have said , a shell script, or a ruby/python script would be a preference for mine.

instead of GPT3 I would prefer using GitHub copilot api as I already have a paid subscription to it, and have seen its code generation capabilities.

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#35

I like the idea, like other people have said , a shell script, or a ruby/python script would be a preference for mine. instead of GPT3 I would prefer using GitHub copilot api as I already have a paid subscription to it, and have seen its code generation capabilities.

They are also working on something similar, https://twitter.com/oegerikus/status/1592977789418098688 You can signup here https://githubnext.com/projects/copilot-cli/

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#36

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…

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.

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#37

I personally don't like the concept of having my terminal send my commands to a remote service, so I'll pass. Hopefully an open source model comes around soon so stuff like this can be implemented locally.

Sure, as long as you've got 350 GB of VRAM to load it.

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#38

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…

Another good example is asking: `ai ask "how to delete a file safely in linux"`

> Command is `shred -u /path/to/file`

A bit of a mix up between safely/securely

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#39

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…

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

#40

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…

For the mere mortal who just needs these commands every once in a while, it’s a huge win though.
Post reply on HN