Skip to content

Instantly share code, notes, and snippets.


Ben Nuttall bennuttall

View GitHub Profile
mapfile -t versions < versions.txt
for v in "${versions[@]}"
echo $v
/usr/bin/time -f "piw-import $package-$v-*.whl -y --duration 00:%E" -ao pip3 wheel $package==$v -q --no-deps --no-binary :all:
View .bashrc
# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
Frimkron / gist:5417267
Created Apr 19, 2013
Quick proof-of-concept for comparing python code using the abstract syntax tree as an alternative to pattern matching . It's a little more forgiving with whitespace, comments etc. First arg is the solution file, second is the attempt
View gist:5417267
import ast
import sys
def find_difference(a,b,lastpos=(0,0)):
if isinstance(b,ast.expr) or isinstance(b,ast.stmt):
lastpos = b.lineno,b.col_offset
if type(a) != type(b): return lastpos
if isinstance(a,ast.AST):
for field in a._fields:
---- repeat with replacements -----
git checkout branchA && git pull origin branchA && git merge branchB && git push origin branchA
piscisaureus /
Created Aug 13, 2012
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 =

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:

View wp-query-ref.php
// This gist is now maintained on github at
* WordPress Query Comprehensive Reference
* Compiled by luetkemj -
* Source:
hughdbrown /
Created Jan 17, 2011
Idea for a git-like backup program
Python script to backup data in src to dst using sha1 hashes of the files
in a backing directory.
Hugh Brown
from hashlib import sha1
import os