Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Nuttall bennuttall

View GitHub Profile
View piwheels.sh
package=$1
mapfile -t versions < versions.txt
for v in "${versions[@]}"
do
echo $v
date
/usr/bin/time -f "piw-import $package-$v-*.whl -y --duration 00:%E" -ao imports.sh pip3 wheel $package==$v -q --no-deps --no-binary :all:
done
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
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:
View bombs.sh
---- repeat with replacements -----
!!:gs<marker>SEARCH<marker>REPLACE
eg
git checkout branchA && git pull origin branchA && git merge branchB && git push origin branchA
!!:gs/branchA/branchC
!!:gs/branchC/branchD
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

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:

View wp-query-ref.php
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@hughdbrown
hughdbrown / sha_backup.py
Created Jan 17, 2011
Idea for a git-like backup program
View sha_backup.py
"""
Python script to backup data in src to dst using sha1 hashes of the files
in a backing directory.
Hugh Brown
hughdbrown@yahoo.com
"""
from hashlib import sha1
import os