Skip to content

Instantly share code, notes, and snippets.

@benhoyt
benhoyt / gist:4044946
Created November 9, 2012 09:59
Speed up os.walk() significantly by using file attributes from FindFirst/Next or readdir
"""Speed up os.walk() significantly by using file attributes that
FindFirst/Next give us instead of doing an extra stat(). Can also do the same
thing with opendir/readdir on Linux.
This is doubly useful when the user (caller of os.walk) is doing *another*
stat() to get say the file sizes.
On my tests (Windows 64-bit) our walk() is about 5x as fast as os.walk() for
large directory trees, and 9x as fast if you're doing the file size thing.
Note that these timings are "once it's in the cache", not first-time timings.
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2: