So far, both the PAN and the PRD claim to have won by a wide margin, while the PRI has happily dismissed all exit polls and hinted to victory for themselves in a long, boring speech.
Meanwhile, the whole country is on the edge of their seats.
Category: General
Mexican elections 2006 @ 20:00hrs
The exit polls of at least three different bureaus point to a tie between Felipe Calderón and López Obrador. In fact, the difference in the poll is inferior to the error margin of every poll.
This just can’t be good.
md5pass
This snippet is a simple wrapper around Digest::MD5‘s md5_base64() builds unsalted MD5 digests encoded in base64, very useful for LDAP management and LDIF file processing.
#!/usr/bin/perl ++$|; use Digest::MD5 qw(md5_base64); if(!defined($pass=shift)) { print "> "; $pass=<STDIN>; chomp $pass; } print encrypted($pass)."\n"; sub encrypted { my($passwd) = @_; return '{md5}'.md5_base64($passwd).'=='; }
Use it as such:
$ bin/md5pass > password {md5}X03MO1qnZdYdgyfeuILPmQ==
[tags]Perl, MD5, code, code snippet[/tags]
Sunday Bloody Sunday
Take a look at this unusual cover of U2‘s Sunday Bloody Sunday by none other than George W. Bush himself, skillfully put together by The party party.
Even though the subtext is not exactly amusing -no, the irony of putting precisely this song in the mouth of Bush is not lost on me- the remix is great and it does make a point about using media mashups for political commentary. Mexican politics would be an endless source for this kind of creative and meaningful videos. Is anyone up for it?
YouTube video.
Via O’Reilly Radar / PinkDome.
[tags]YouTube, video, Bush[/tags]
Some lovely ASCII Art
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.
[tags]Perl, Python, Obfuscation, ASCII art[/tags]
Griffin radio SHARK + icecast2 on Debian GNU/Linux
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:
linux-image-2.6.15-1-k7 | 2.6.15-4 |
linux-source-2.6.15 | 2.6.15-4 |
libhid-dev | 20060325-2 |
libhid0 | 20060325-2 |
icecast2 | 2.3.1-3 |
darkice | 0.17-1 |
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:
[general] duration = 0 bufferSecs = 5 reconnect = yes [input] device = /dev/dsp sampleRate = 22050 bitsPerSample = 16 channel = 2 [icecast2-0] 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.
Miserably Sad
Today the world is a worse place that it was a few hours ago. I got word –and just confirmed– that my mentor, my teacher and overall good man Rosendo Pardo Osuna was run over by some bastard in a car.
They took you away from the Campus you built, but nobody was able to take you away from the place you loved so much. You will always live in the heart of all the people you touched — if anything, we can attest to your loving, caring work.
But I miss you already, Inge.
The Sad iPod Syndrome
A couple of months ago my (formerly) trusty iPod anounced its impending death and I didn’t listen. Sure, it hung up a couple of times, but it had done that before. When I tried to connect it to a PC to feed it the latest podcasts the PC hung up, but Windows machines do that, too. A lot. Later I copied an ISO image to the laptop under Linux, and it took an unusually long time, but I was tired and didn’t even think of taking a look to dmesg. When I whipped out the iPod to listen to some music during an 11-hour flight only to find out that the battery was dead –even tough I had charged it overnight– I didn’t gave much importance to the issue. I just forgot to toggle the hold switch, I rationalized. So when it definitely locked up with a whirring noise and the clicks that usually announce the death of a hard disk, it came to me as a surprise. I felt a cold sweat down my back as an exclamation point appeared on the screen, inviting me to visit the Apple support website.
*Then* I remembered that I don’t have a backup of my iPod.
Of course, my iPod has a copy of my entire music collection. Heck, the iPod *is* my entire music collection, since it has every track of every CD I have ever bought, including many that have been lost or stolen. On top of that, it has more that 5GB of podcasts, a few ISOs, an essential software collection and an encrypted volume with a backup of critical information. The data files didn’t worry me as much as the music, because most of them were just backup files, but recreating that volume was going to be bothersome at best.
Now about the music… I have spent countless hours tagging, classifying and pasting artwork and lyrics to my music. That really hurt.
The iPod got worse really fast. After following the instructions on the Apple website a couple of times to get it into disk mode just to be ignored by the PC in turn, the folder icon was replaced by the dreaded Sad iPod icon. That’s it for the iPod, i tought. I should have bought that 60GB iPod with the color screen when I had the opportunity, instead of waiting for an 80GB model that never materialized.
When I followed the instructions on Apple.com I saw that Apple is more than willing to replace my out-of-warranty 4G iPod –engraving and all– after I dutifully paid US$250. Or I could shell out a few more bucks for a newer model, and forego all the accessories I have bought over the last three years, which have cost a small fortune and none of which will work with a video iPod. Smart move, Steve.
So let’s move on to the other option: perhaps I can replace just the hard drive. *Mmmh…* They go for some USD$100 for a 20GB one, and about USD$130 for the 40GB I need. That’s about half the tribute to Apple for a replacement. So I started looking for other people’s experiences replacing a broken iPod HD, and came across a post detailing William Mitchell’s own encounter with the Sad iPod icon, a reference to Josh Highland’s experience replacing an iPod HD and a cryptic reference to “dropping the iPod” near the end. Josh’s instructions are pretty straightforward, but when I read the comments to his post I found out that apparently many people have had success reviving their iPod by smacking it. Now in my experience one thing is dropping and Apple ][ a few inches to settle the RAM ICs into their sockets, but smacking an iPod to “realign” the HD head is something entirely different. I’m a trained Electronics Engineer. I am a member of the ACM. I *know* that this is not the way things work. But since the HD was dead anyway I decieded to give it a try.
I read the instructions again. No, there was no mention of any blood sacrifice or any other form of dark magic that could compromise my soul any further. I toggled the hold switch exactly ten times. I took the iPod with my left hand, and slapped the right side firmly. I turned the iPod on, and lo and behold: the whirring noise was gone, the clicks wheren’t there, and the iPod worked. My belief system was shaken to its core.
Now I can attest to the miracle.
I connected the iPod to a PC immediately and it was recognized. I spent a couple of hours looking for a program that could backup a selection of the songs in the iPod — podUtil is nice but won’t work in advanced mode unless you register, and in basic mode a nag screen pops up every 50 songs or so. ephPod is still broken, and YamiPod is great but Smart Playlists don’t work. Everyone else want to set you back at least US$19 for the privilege of backing up /your/ music from /your/ iPod to /your/ computer — a feature that iTunes should have in the first place. What the heck. I just plugged it into a Linux box and rsync’ed the entire partition –including the entire iPod_Control– to the storage server. It complained with I/O errors in a couple of files, which were promptly dd’ed with zeroes just in case the HD controller is able to reallocate those bad sectors. I entered the diagnostics mode and ran a HDD scan which the iPod passed with flying colors. And it is still working and merrily pumping out music as I write this.
The lessons I learned: Smacking stuff to make it work applies to high-tech gear as well, unbelievable as it may seem. Apple needs to provide an easy, intutive way to back up your music or move it between your iPods without resorting to third-party utilities. Throwing out backwards compatibility for consumer electronics is a smart financial move for Apple and its licensees, but it doesn’t make any sense for the consumers themselves. And finally the iPod is no walkman — you still have to back it up periodically. I should have known better.
So it looks that the iPod is fully functional again. I just *know* that the HD will fail again –probably for good this time– so I ordered a replacement HD anyway. But now I have my music and my tags securely backed up, so I won’t care as much when the iPod breaks again during the next worktour.
Update: In an amazing display of synchronicity, I just read Fate’s latest post on this same topic. I swear I had not seen it before, nor discussed this specific remedy with him (Actually, I still owe him a cup of coffee)… Perhaps there are no coincidences after all?
gammu
Gammu -the GNU All Mobile Management Utilities formerly known as MyGnokki2- is a full-featured cellphone manager for *nix and Win32. Its makefile knows about .debs and .rpms, it is incredibly easy to configure and -unlike Gnokii- it supports the Nokia 3200 (RH-31) right out of the box through an inexpensive DKU-5 cable.
Right now I’m using this simple /etc/gammurc under Debian GNU/Linux with kernel 2.6.12:
[gammu] port = /dev/ttyUSB0 model = 3200a connection = dku5fbus synchronizetime = yes #logfile = gammulog #logformat = textall use_locking = yes gammuloc = locfile startinfo = yes gammucoding = utf8 rsslevel = teststable usephonedb = yes
# gammu --identify duly reports
Manufacturer : Nokia Model : 3200a (RH-31) Firmware : 5.29 I (22-10-04) Hardware : 1620 IMEI : 356656xxxxxxxxx Original IMEI : 356656/xx/xxxxxx/x Manufactured : 06/2005 Product code : xxxxxxx Simlock data : xxxxxx Old simlock : TELCEL GSM (xxx xx) UEM : xxxx
Métro
(*ack!* WordPress ate my post!)