Skip to content

Instantly share code, notes, and snippets.

View jrabbit's full-sized avatar
🍡

J Laxson jrabbit

🍡
View GitHub Profile
@jrabbit
jrabbit / gist:507352
Created August 3, 2010 23:20
Quick and dirty script to set SDL env for Alien::SDL
#!/usr/bin/env python
from subprocess import *
import os
sdlconf = Popen(['sdl-config', '--prefix'], stdout=PIPE).communicate()[0]
pkgconf = Popen(['pkg-config','sdl', '--libs'], stdout=PIPE).communicate()[0]
if sdlconf:
prefix = sdlconf
elif pkgconf:
@jrabbit
jrabbit / gist:468298
Created July 8, 2010 16:56
Keith Olbermann's closing simulator
import time
daynum=int(time.strftime('%j'))
year=int(time.strftime('%y'))
composite=(year*365)+daynum
def ordinal(n):
if 10 <= n % 100 < 20:
return str(n) + 'th'
else:
return str(n) + {1 : 'st', 2 : 'nd', 3 : 'rd'}.get(n % 10, "th")
#thanks http://stackoverflow.com/questions/739241/python-date-ordinal-output/739301#739301