Skip to content

Instantly share code, notes, and snippets.

View brianriley's full-sized avatar

Brian Riley brianriley

View GitHub Profile

Keybase proof

I hereby claim:

  • I am brianriley on github.
  • I am brianriley (https://keybase.io/brianriley) on keybase.
  • I have a public key ASChNEIv5UvVaov2Uza4YYNwRvUyZXpE_CTpiPN67FoFWgo

To claim this, I am signing this object:

@brianriley
brianriley / gist:3096249
Created July 12, 2012 06:24
Game of Life with cells colored based on their neighbor density
int FRAME_RATE = 12;
int CELL_SIZE = 5;
int PIXEL_WIDTH = 1400;
int PIXEL_HEIGHT = 800;
float INITIAL_POPULATION_DENSITY = 0.5;
// white (neighbor density = 8), yellow (neighbor density = 7), orange (neighbor density = 6), red (neighbor density = 5), purple (neightbor density = 4), blue (neighbor density < 4)
color[] colors = {color(255,255,255), color(255,255,0), color(255,166,0), color(255, 0, 0), color(255,0,255), color(0,0,255)};
@brianriley
brianriley / gist:2432321
Created April 20, 2012 22:25
Upgrade all installed pip packages
pip freeze | awk '{split($1, a, "=="); print a[1]}' | while read package; do pip install $package --upgrade; done
"""
Usage:
>>> list_files('/tmp')
['/tmp/one', '/tmp/two', ... ]
"""
import os
def list_files(directory, files=[]):
for item in os.listdir(directory):