Hacker News new | ask | show | jobs
by nickcw 1310 days ago
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
2 comments

That serverfault link seems to be completely random and takes me to a StackOverflow page(?)
Netstat is becoming an optional package on many distributions in favor of ss.