Monday, March 23, 2009

feelin' randy!

Shuffle! Chaos! Randomness! Surprise me! How many times... have you wanted to:
  • shuffle a list of mp3 to pass to mplayer
  • randomize a list of background images to eog
  • pick a random file from a directory
Once or twice? OK! These can all be boiled down to reading in lines from stdout, mixing 'em up and spewing them back out in a random order.

Check out this tiny haxe program called randy. It's self compiling:
% wget http://brianin3d-misc.googlecode.com/svn/trunk/random/haxe/Randy.hx
% chmod 755 Randy.hx
% ./Randy.hx
% echo -e "1\n2\n3" | ./randy
1
3
2

I wrote it just 4u!

No comments:

Post a Comment