Skip to content

Instantly share code, notes, and snippets.

View ihincks's full-sized avatar

Ian Hincks ihincks

View GitHub Profile
@ihincks
ihincks / tuple_encoder.py
Created June 17, 2016 03:09
For those times you need tuples of non-negative integers to be non-negative integers...
#!/usr/bin/python
from __future__ import division
import numpy as np
def tuple_encode(x):
"""
If x is a tuple of non-negative integers, outputs a single non-negative
integer which is unique for that tuple, based on Cantor's bijection
argument.
"""
@ihincks
ihincks / multi-bibtex
Created September 10, 2014 16:48
Call bibtex on all .aux files in directory with given base.
#!/usr/bin/python
'''
A call to this script
multi-bibtex [options] texfile[.aux]
will result in the commands
bibtex [options] file.aux
being called for every file in the folder of texfile which
starts with "texfile".
This is useful, for example, when you want to use bibtex
(as opposed to biber which does what we want automatically)