gist: a tiny Gist client
Lately I’ve been on a bit of a shell scripting craze. I wanted to create a simple GitHub Gist client which enabled me to save snippets easily. After finding a simple tutorial about using curl with GitHub’s Gist API I discovered that creating a simple shell script (gist) was suprisingly easy.
The script uses a piping “hack” that I borrowed from Julian Gruber’s vipe.sh. This means that it enables us to pipe a file directly into it, like this:
We can also rename the gist to something a bit more useful than the default
gist.txt
:
Note that the script will prompt you for your password. You could change
username="USER"
to username="USER:PASS"
, but if you only use it once every
couple of days or so I suggest you to not save your password in plain text,
especially if you store your scripts in a git repository.