Tuesday, November 3, 2009

Hilarious



Something's wrong though -- this is totally NOT Interpol. It's sort of a behind the scenes for the Rollins Band. Henry Rollins actually played a part in Johnny Mnemonic!!! Wow!

What a party!

Garage band

Friday, October 16, 2009

Bizarre Love Triangle

Original version by New Order



Cover by Frente!



Cover by Stabbing Westward (my favorite)

Wednesday, August 26, 2009

Interpolation with SciPy

This didn't take long, thanks to SciPy.


from scipy.interpolate import interpolate as interp

xa = [i * 10 for i in range(10)]
ya = [200.0 + 1.5 * x for x in xa]

iobj = interp.interp1d(xa, ya)
i_xa = [i for i in range(90)]
i_ya = [iobj(x) for x in i_xa]

import pylab as pl
pl.plot(xa, ya, "o")
pl.plot(i_xa, i_ya, "-")
pl.ylim(0, 1000)
pl.show()

Friday, August 7, 2009

A portable way to pass a string to C as a macro


#define STRINGIZE_(x) #x
#define STRINGIZE(x) STRINGIZE_(x)


And call STRINGIZE(x) in subsequent code. This is useful when using the -D option in gcc -- without STRINGIZE(), extra double-quotes (\") must be added in order to pass strings as macros from the command line.

Sunday, March 1, 2009

Conditional expression in Python

It has bothered me for a long time that Python does not provide a conditional expression operator similar to the ?: operator used in C. But by some fortune, I ran across this Python snippet:

("False", "True")[var == True]

which does exactly the same as what you would write in C

var ? "True" : "False"

What a relief!