John McCallum http://cfljam.github.io/
Install the Ruby gem
!sudo gem install gist
Fetching: gist-4.3.0.gem (100%) Successfully installed gist-4.3.0 1 gem installed Installing ri documentation for gist-4.3.0... Installing RDoc documentation for gist-4.3.0...
!gist -h
Gist (v4.3.0) lets you upload to https://gist.github.com/ The content to be uploaded can be passed as a list of files, if none are specified STDIN will be read. The default filename for STDIN is "a.rb", and all filenames can be overridden by repeating the "-f" flag. The most useful reason to do this is to change the syntax highlighting. If you'd like your gists to be associated with your GitHub account, so that you can edit them and find them in future, first use `gist --login` to obtain an Oauth2 access token. This is stored and used by gist in the future. Private gists do not have guessable URLs and can be created with "-p", you can also set the description at the top of the gist by passing "-d". Anonymous gists are not associated with your GitHub account, they can be created with "-a" even after you have used "gist --login". If you would like to shorten the resulting gist URL, use the -s flag. This will use GitHub's URL shortener, git.io. You can also use -R to get the link to the raw gist. To copy the resulting URL to your clipboard you can use the -c option, or to just open it directly in your browser, use -o. Using the -e option will copy the embeddable URL to the clipboard. You can add `alias gist='gist -c'` to your shell's rc file to configure this behaviour by default. Instead of creating a new gist, you can update an existing one by passing its ID or URL with "-u". For this to work, you must be logged in, and have created the original gist with the same GitHub account. Usage: gist [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL] [-P] [-f NAME|-t EXT]* FILE* gist --login --login Authenticate gist on this computer. -f, --filename [NAME.EXTENSION] Sets the filename and syntax type. -t, --type [EXTENSION] Sets the file extension and syntax type. -p, --private Makes your gist private. --no-private -d, --description DESCRIPTION Adds a description to your gist. -s, --shorten Shorten the gist URL using git.io. -u, --update [ URL | ID ] Update an existing gist. -a, --anonymous Create an anonymous gist. -c, --copy Copy the resulting URL to the clipboard -e, --embed Copy the embed code for the gist to the clipboard -o, --open Open the resulting URL in a browser --no-open -P, --paste Paste from the clipboard to gist -R, --raw Raw url of the new gist -l, --list [USER] List all gists for user -h, --help Show this message. -v, --version Print the version.
vagrant@vagrant-ubuntu-trusty-64:~$ gist --login
Obtaining OAuth2 access_token from github.
GitHub username: cfljam
GitHub password:
Success! https://github.com/settings/applications
!head -n 25 Gisting\ iPython\ Notebooks.ipynb
{ "metadata": { "name": "", "signature": "sha256:0c8b2f30bbd5e894dbd46f59461aed871e9ea7e1aadae713464ec06c9964390d" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Saving iPython Notebooks as Gists\n", "=================\n", "\n", "- see https://gist.github.com/\n", "- Github [Gist](http://en.wikipedia.org/wiki/GitHub#Gist) is a pastebin-style site for saving text snippets \n", "- its free\n", "- Gists can be public or secret (unguessable hash hidden form search engines)\n", "- files cant be too big\n" ] }, {
!gist -d "How to Gist an iPython Notebook" Gisting\ iPython\ Notebooks.ipynb
https://gist.github.com/a44c48e20a78e704ba1f
This Gist is now visible
so you can store and share a link with this rendering URL
You can get NBViewer extensions and a bookmarklet for Chrome and Firefox at http://jiffyclub.github.io/open-in-nbviewer/
Just pass the filename and the URL https://gist.github.com/a44c48e20a78e704ba1f to gist with the update (-u) flag
!gist -u https://gist.github.com/a44c48e20a78e704ba1f Gisting\ iPython\ Notebooks.ipynb
https://gist.github.com/a44c48e20a78e704ba1f
If you check the Gist URL, https://gist.github.com/cfljam/a44c48e20a78e704ba1f you can see that these changes are reflected in the revision history
Gists are a simple versioned file storage solution tat can be treated like an GitHub repository.
from IPython.display import Image
Image('/vagrant_data/Screen Shot 2014-10-12 at 9.49.56 am.png')