How to share code snippets from command line

Gist.github.com is a great service provided by GitHub, useful to share code snippets.
You can share single files, parts of files, or full applications: every gist is a Git repository, which means that it can be forked and cloned.

I’ve developed this simple python script useful to share sourcecode on gist from command line:

[embed]https://gist.github.com/andreafortuna/bc5405026c933ff390134fec941fc9fc[/embed]

 


Usage

Pretty simple!

For example, to publish the gist embed in this post, i’ve used this command:

python gist.py ./gist.py [GitHub Username] [GitHub Password]