I’m in your internets, sniffing your packets

July 15, 2009
Rocking Wireshark on my EeePC on the train to Stockholm

Rocking Wireshark on my EeePC on the train to Stockholm


Crowdsourcing your iTunes music with PHP, AppleScript and Twitter

February 20, 2009

The other day I was catching up on the last few episodes of Hak5, one of my favorite internet-TV shows, and in one episode Darren Kitchen was doing some neat tricks with PHP, Twitter and VLC. This got me thinking about what other kinds of fun projects Twitter could be used for.

Twitter is a great service, not very reliable however (fail whale anyone?), and there are already plenty of mash-ups that uses it for various things. My idea was to use Twitter to select what plays in iTunes. People could send me replies with songs in them and if the song was in my iTunes-library it would be played, as simple as that. Not very useful, but a fun experiment if nothing else. So I started coding.

In order to control iTunes I had to delve into AppleScript for the first time. I find it to be an odd language, but whatever, for this project it’s definitely the most appropriate choice for getting quick results. One of my favorite languages is PHP so that’s what I chose for the control structure of the whole thing.

A couple of hours later I had my first prototype and now an additional few hours of tweaks I give you… TwitTunes!

This is how it works:
Person #1 starts TwitTunes on his Mac. TwitTunes sends a tweet – “#TwitTunes starting” – using Person #1s Twitter-account to let the world know that it is running.
Person #2 sends a reply on Twitter containing search words. These search words are then used to search through Person #1s iTunes-library and the first matching song found is played.

Not very fancy and far from perfect, but admit it, crowdsourcing your jukebox via Twitter is a pretty nifty idea and this is my very first proof of concept 😉

If you wanna try out TwitTunes yourself you can download it here (sloppy source code included of course), and if you have any feedback I’ll be happy to hear it.


Woz hacking Kathy Griffin’s iPhone

June 13, 2008

I couldn’t help but chuckle at this. Also, this is a little what my relationship with my girlfriend is like. Maybe that’s why I found it so amusing.


USB on/off-switch mod

September 30, 2007

Last week I got the idea to create a USB-cable with an on/off-switch. This because I have several USB-devices (mug heater, mug chiller, reading light, battery charger, etc.) that have no on/off-switch and I think it’s really tiresome having to unplug them every time I want them turned off.

So I looked up USB on Wikipedia and learned, amongst other things, that the 5V power that a USB-port supplies travels through the red wire inside the USB-cable. So it should really not be any more difficult than just cutting the red cable and connecting the ends to an ordinary on/off-switch that you can buy in any store that carries electronics and such.

It took me a couple of tries to get it right though. Inside a USB-cable there’s not just the four wires (red, black, green and white) that send power and data back and forth but also foil that wraps around all four wires and a bunch of thin metallic wires and apparently this foil and possibly also the metallic wires should not be removed when pealing the outer insulation off the USB-cable because then it will not work. It took me three USB-cables to figure that one out. Very frustrating.

But anyway, on the third try I got it right and I now have a USB-cable with a nice on/off-switch mounted on it and I can turn my mug chiller on and off just like I do the reading lamp by my bed. Mission accomplished.


Spicing up your e-mail signature for fun and… well… fun!

March 21, 2007

Recently I got tired of my e-mail signature always looking the same. It bored me but I’m a bit too lazy to be changing it myself very often. So I figured out a way to spice it up a little and make it update itself automatically.

The tools I used for this tiny little project was the neat little application fortune and cron.

If you’re using any sort of real operating system you already have cron installed. Chances are that you have fortune as well, but if you don’t it shouldn’t be very hard to find from some repository or other download source. If you are, like me, a Fedora Core user you will find it in the extras repository.

What fortune does is that it outputs a random quote taken from an installed database of quotes. There are plenty of funny and interesting quotes available for inclusion in this database, such as quotes taken from movies, books and TV-shows.

So I simply wrote a bash-script that takes a base signature, which in my case contains some contact information and the URL to my GnuPG public key, adds this to the output from fortune and stores it all in a simple text file. The resulting file is what I then tell my e-mail client to use for a signature.

The script looks like this:

#!/bin/bash
SIGN_DIR=/home/hayabusa/documents
rm -f $SIGN_FILE/mailsignature
cat $SIGN_DIR/basesignature > $SIGN_DIR/mailsignature
fortune >> $SIGN_DIR/mailsignature
exit 0

So as you can see, nothing fancy at all.

Then to make the signature change once every fifteen minutes I added this row to my /etc/crontab:

*/15 * * * * hayabusa /home/hayabusa/bin/mailsign_maker.sh >/dev/null

Now let’s see for how long this keeps me “not bored” with my e-mail signature 😉

Oh, and by the way, I realize I am far from the first that’s done something like this. I just figured I might not be the last wanting to do it either.