Skip to content

Instantly share code, notes, and snippets.

View ethanwhite's full-sized avatar

Ethan White ethanwhite

View GitHub Profile
@jiffyclub
jiffyclub / runtests.py
Created November 4, 2012 20:28
An IPython %runtests magic that does some very basic test function discovery, running, and reporting within IPython.
from IPython.core.magic import register_line_magic
@register_line_magic
def runtests(line):
"""
The %runtests magic searches your IPython namespace for functions
with names that begin with 'test'. It will attempt to run these
functions (calling them with no arguments), and report whether they
pass, fail (raise an AssertionError), or error (raise any other
@jiffyclub
jiffyclub / nbviewer_bookmarklet.js
Created October 17, 2012 00:56
A bookmarklet that tries to open the current page in nbviewer. White space has been trimmed for brevity. To use make a new bookmark and copy the code below into the URL field.
javascript:date=new Date();
url_root='http://nbviewer.ipython.org/';
url=null;
if (location.href.search(/^https?:\/\/gist\.github\.com\/[0-9]+$/) !== -1) {
gist = location.href.match(/^https?:\/\/gist\.github\.com\/([0-9]+)$/);
url = url_root + gist[1];
} else if (location.href.search(/^https:\/\/.*\.ipynb$/) !== -1) {
path = location.href.match(/^https:\/\/(.*\.ipynb)$/);
url = url_root + 'urls/' + path[1];
} else if (location.href.search(/^http:\/\/.*\.ipynb$/) !== -1) {
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ethanwhite
ethanwhite / gource-multiple-repositories.sh
Created May 2, 2012 15:14 — forked from anonymous/gource-multiple-repositories.sh
Generates gource video out of multiple repositories.
#!/usr/bin/env bash
# Generates gource video (h.264) out of multiple repositories.
# Pass the repositories in command line arguments.
# Example:
# <this.sh> /path/to/repo1 /path/to/repo2
i=0
for repo in $*; do
# 1. Generate a Gource custom log files for each repo. This can be facilitated by the --output-custom-log FILE option of Gource as of 0.29:
logfile="$(mktemp /tmp/gource.XXXXXX)"
anonymous
anonymous / gource-multiple-repositories.sh
Created March 24, 2011 01:10
Generates gource video out of multiple repositories.
#!/usr/bin/env bash
# Generates gource video (h.264) out of multiple repositories.
# Pass the repositories in command line arguments.
# Example:
# <this.sh> /path/to/repo1 /path/to/repo2
i=0
for repo in $*; do
# 1. Generate a Gource custom log files for each repo. This can be facilitated by the --output-custom-log FILE option of Gource as of 0.29:
logfile="$(mktemp /tmp/gource.XXXXXX)"