The answer to this was more difficult to find than it should have been. The best answer is on stackoverflow here. In short, use the git archive command: git archive –firstname.lastname@example.org:foo/bar.git –prefix=path/to/ HEAD:path/to/ | tar xvf – For this to work the owner of the git server needs to have enabled upload-archive (git config daemon.uploadarch… Read More Retrieve a single file from a git repo.
If you’ve grown fat and complacent using Python, try a little Cython. It’ll put hair on your chest and take some off your scalp. Take the following Cython code I was writing (heavily paraphrased) This code compiles file. It even runs fine for a few test cases I set up for it. But when I… Read More How to shoot yourself in the foot with Cython
Getting more out of your Cython code doesn’t have to be a black art. A key step is to peek into the cythonized .c file and note if inner loops are getting down to bare C without any of the overheads associated with Python’s dynamism. In an earlier post I had introduced Cython, which is… Read More Get more out of Cython
Python has an efficient, and built in, implementation of set operations. With a tiny bit of work you can make your user defined classes work nicely with set operations (as well as dictionaries). Say you have a class: class A: def __init__(self, x, s): self.x, self.s = x, s Python actually doesn’t have a way… Read More Using user classes with Python’s set operations
It’s pretty awesome that Sphinx will work with Cython code files (.pyx) but there are currently a few wrinkles: You need to rerun the cython compiler before the documentation changes take since sphinx reads this off the compiled library Function signatures are omitted in the documentation and the compiler directive # cython: embedsignature=True does not… Read More Sphinx + Cython