Andrew Savige’s Bottles of Beer have been found by the Python pundits (and by some gutless Perl defectors ;-) ) and are being waved as a textbook executable-line-noise example. There’s people that can’t stand beauty when they see it.
(That code is now an image -see below- but you can always get the original source code).
Yup, it is a Perl program. Yes, it *does* run, with interesting results. There’s even a CPAN module — Acme::EyeDrops — that turns your own Perl programs into purposely unmaintainable yet beautiful works of art that can make the entire Python Party cringe in disgust. You have to admit that there’s certain merit in making grown men cry. Automatically, no less. Go and read how it’s done.
So the Obfuscated Python Contest is incredibly boring. I couldn’t care less.
Via Carlos de la Guardia/Marc Abramowitz/Chris Petrilli.
Update 20060916: Replaced the code with a graphical version because WordPress 2.0 doesn’t play well with the text hightlight plugin.
I have been meaning to get a Griffin radioSHARK with the intention of getting it running on Linux. Since it has a nice discount over at amazon I ran out of excuses for not buying one, so I finally ordered it.
Once the sweet sweet parcel arrived the radio SHARK sat for a couple of weeks gathering dust while I got a moment to play with it. Trying to get it to run in Windows XP was totally fruitless. The only way I got it to spit any sound at all was while in audio “test” mode. Not really an option, but at least it meant that that the hardware was working fine.
So now it was time to move it over to Linux. The definitive guide for the radioSHARK under linux is at LinuxQuestions.org. They recommend ecasound to transcode the audio input to the sound card in a single computer, but I rather use icecast2 to stream the signal to different computers around the house — even to the office or while I’m on the road. I don’t care much for the time-shifting feature of the Windows/Mac client, and the record function can be replicated with VLC save to disk function or using command-line tools.
The program that controls the radioSHARK lights and change the current station is shark.c, but if you get it from LinuxQuestions.org you’ll have to copy+paste and clean it up a bit, so you might want to use this ready-to-go shark.c instead.
This is the list of packages for Debian GNU/Linux:
So how do you get a full-functioning, live-streaming, all-singing radioSHARK working under Debian?
- Plug the radioSHARK in the USB port you’ll get this in dmesg:
usb 1-2: new full speed USB device using uhci_hcd and address 3
usbcore: registered new driver hiddev
input: Griffin Technology, Inc. RadioSHARK as /class/input/input2
input: USB HID v1.00 Device [Griffin Technology, Inc. RadioSHARK] on usb-0000:00:10.0-2
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.6:USB HID core driver
- Compile shark.c using
gcc -g -o shark -lhid shark.c
- Copy shark to /usr/local/bin
# cp shark /usr/local/bin
- Check that your brand-new shark is working:
# /usr/local/bin/shark -blue 60
- Edit /etc/icecast2/icecast.xml and fill out at least the authentication and hostname sections.
- Copy /usr/share/doc/darkice/examples/darkice.cfg to /etc/darkice.cfg and edit to taste. My own configuration goes something like this:
duration = 0
bufferSecs = 5
reconnect = yes
device = /dev/dsp
sampleRate = 22050
bitsPerSample = 16
channel = 2
bitrateMode = vbr
format = vorbis
bitrate = 32
quality = 0.8
server = localhost
port = 8000
password = icecastPassword
mountPoint = radio.ogg
name = Radio MexicoDF
description = Radio from Mexico, D.F.
url = http://your.url
genre = misc
public = yes
- Start up icecast2 running /etc/init.d/icecast2 start and check out that it’s running by opening http://localhost:8000/ . You should get a status screen without any streams.
- Start up darkice with /usr/bin/darkice -c /etc/darkice.cfg . When you reload http://localhost:8000/ in your web browser you should get a stream mount point with your newly defined stream. Tune in to the stream URL using XMMS, VLC, WinAmp or your favorite audio player, and you sould hear something, at least some white noise.
- To change stations use
# /usr/local/bin/shark -fm 102.5
After a few seconds -depending on your audio player buffer size- you should hear the new station.
My next weekend project will be to create a web front-end to shark — perhaps even implement a record-to-disk option.