Last Updated: February 25, 2016
· xanza

Ruby Gist Script

Using this script you can transfer text directly to a Github gist. I use it for many different things from to-do lists, to idea's that I might have. This script has the ability to upload text as public, or private.

There are a few different way's that you can go about installing the script, the easiest would be to use ruby's gem installer:

gem install gist

alternatively, if you prefer (gem install takes forever sometimes) you can simply use curl, or wget to download the hosted script:

wget > gist && chmod 755 gist && mv gist /usr/local/bin/gist

or curl:

curl -s > gist && chmod 755 gist && mv gist /usr/local/bin/gist

Alternatively, if you don't have access to * /usr/local/bin/gist * you can simply edit your .profile, .cshrc, or .bashrc files and simply make an alias:

mkdir ~/.bin && cd ~/.bin
wget > gist && chmod 755 gist

open your .profile, .cshrc, or .bashrc file with your favorite text editor and add:

alias gist='~/.bin/gist'

There are many different way's to use the script, however to begin using the script you need to ensure that you have Git installed, and setup with your Github username and password:

git config --global github.user "your-github-username"
git config --global github.password "your-github-password"

Once you've done that, you're ready to start submitting gists:

gist < file.txt

submit file.txt as a public gist

gist script.js notes.txt

submit both script.js and notes.txt as multiple public gists

echo "puts :hi" | gist -t rb

uses standard output to gist a simple ruby script with highlighting (-t specifies script type: 'gist -t php')

gist -
the quick brown fox jumps over the lazy dog

enables gist via stdin

Note: -p or --private will hide your gist from public view
gist -h | Help
gist -m | Manual

1 Response
Add your response

Great tip. Used it just now to put a large number of small files on a Gist for consumption by others. Thanks!

over 1 year ago ·