Oct 27 2008
20:21 ah, , try giving it another user name. it stops working if "you" have already won
Nov 3 2008
20:46 <tags> ?
Nov 4 2008
10:21 click to yabber
11:49 sweet :)
15:52 sdf sdf
Nov 5 2008
01:46 .
20:38 i hate lvl 58 59 65
Nov 13 2008
04:35 blargh?
13:41 jan liker banan!
21:03 pk
Nov 14 2008
01:45 WTF level 54? What is it that I can't see?
20:54 aef
Nov 18 2008
20:52 bucuresti
Nov 19 2008
13:29 timisoara
Nov 20 2008
10:31 why can't I recursively unzip the contents of droste.zip!!!
12:22 MORIYA

steike / code / playsound

For some reason there is no standard utility to play a sound file from a shell script. Well, here's one.

To use it, you just type

playsound foo.wav

You can download just the executable (Intel | PPC | ZIP file), or the source below. Place the file in /usr/local/bin, or wherever you feel comfortable with it. Such as inside your polish IM client :-)

Downlod this snippet as playsound.m

#import <Cocoa/Cocoa.h>

@interface Delegate : NSObject { }
@end

@implementation Delegate
- (void) sound: (NSSound *) sound didFinishPlaying: (BOOL) aBool
{
  [[NSApplication sharedApplication] terminate: nil];
}
@end


int main (int argc, char *argv[])
{
  if(argc!=2) {
    NSLog(@"usage: %s cowbell.wav", argv[0]);
    exit(1);
  }

  [[NSAutoreleasePool alloc] init];
  
  NSSound *sound = [[NSSound alloc]
		     initWithContentsOfFile: 
		       [NSString stringWithCString: argv[1]]
		     byReference: YES];
  
  [sound setDelegate: [[[Delegate alloc] init] autorelease]];
  [sound play];

  [[NSRunLoop currentRunLoop] run];

  return 1; // failed
}

Downlod this snippet as Makefile

test: playsound
	./playsound '/Applications/Mail.app/Contents/Resources/Mail Sent.aiff'
playsound: playsound.m Makefile
	gcc -o $@ -Wall -Os -framework Cocoa $<

[Comment on this]