Skip to content

Getting a list of your Firefox tabs

Just a quick Perl hack I put together last night. This "oneliner" reads the sessionstore.js file and prints the URLs of all tabs you're currently looking at. I also noticed that the sessionstore contains lots of other useful information, including all session cookies. I'm quite sure that will come in handy some day. :-D I took a quick look for code that does this, and found people trying to put some complicated grep/regex together, but that seemed way too fragile to me. One person did it in JavaScript (which makes a lot of sense since the session store is encoded as a JavaScript data structure), and I decided to go that way as well except I'm using Perl's JavaScript module so it can still run on the command-line. :-)

CODE:
#!/usr/bin/perl

use JavaScript;

my $rt = JavaScript::Runtime->new();
my $cx = $rt->create_context();

$cx->bind_function(fetch => sub { print( $_[0] . "\n" ); });

$sess = `cat ~/.mozilla/firefox/*.default/sessionstore.js`;

$sessparser = <<EOF;
for( var win_ in sess['windows'] )
{
win = sess['windows'][win_];
for( var tab_ in win['tabs'] )
{
tab = win['tabs'][tab_];
fetch(tab['entries'][tab['index'] - 1]['url']);
}
}
EOF

$cx->eval('var sess = ' . $sess . ';' . $sessparser);


And yes, my code is indented, but my shitty blog software likes to break it.

My laptop received a tour through LA!

This week I'm frantically reloading the UPS package tracking page of my laptop shipment every few hours, and it looks like last night my package received a free tour through LA!

Screenshot of UPS tracking page showing that my package went from Vernon to Cerritos, and then back to Vernon

Back where it was about 24 hours ago apparently. :-( And LA is over 600 km away from here so I really wonder if they're still going to make it for delivery tomorrow... While looking at the map to see where these places are, I did notice one odd detail:

The other Californian Mountain View

Apparently there's another thing called Mountain View in California. Did the package courier get confused? :-)

Update: Apparently it arrived in San Francisco at 17:40 today even without a departure scan from Vernon. I guess I should just take this tracking page with a grain of salt. :-)

Mountain View, TAPFS and yet another gallery

Writing from Mountain View again! Landed on Thursday, spent one day at work so far and today I got my bicycle fixed up so I can use it for commuting again. It's nice how year after year, the thing still works for me, all it needs when I come is some extra air in the tires. :-) One thing California is really not doing well this year is the weather, though. It's raining for two days already!

In other news, I should definitely be plugging The Australian Pink Floyd Show in this post. They were in Dublin about a week ago and they're amazingly good. Even a singer that sounds a lot like Roger Waters! The show was great too, with inflatable animals and everything, and the music sounded perfect. This tour they're playing all of The Wall, and for that that means not just a "copy" of the CD, but also many of the little filler pieces that PF used to play during the concerts.

Also working on a bit of OSS these weeks, adding more "diversity" to the already bloated landscape of gallery webapps. I'm making a difference though, SRSLY! I found myself making a lot more pictures since I bought my first dSLR and many of them aren't really part of an album/event or anything like that. I could just put them on Flickr or Picasa and be done with it, but that'd break my time-wasting tradition of hosting everything myself.

I already use F-Spot to manage my pictures, so it'd be nice to have a web gallery that can automatically use tag information from F-Spot. Turns out there are two programs that can do this already. They're not for me though; they automatically export everything, and there are pictures that I'd rather keep for myself. :-P

I then tried to adapt "original" to my wishes, but gave up when I saw it doesn't quite use templates and am rewriting it now using web.py and Cheetah templates. Going well, but TBH I feel homesick to PHP. Not that it's such a great language, it's more that I fail to understand why there are 982397832 different webapp frameworks for Python/WSGI/mod_python/whatever instead of just one that actually works.

This is a work in progress, and the progress is good. :-) Once it's done, I'll be able to post pictures here of my new radio-controlled airplane and other neat stuff. Yaaaay...

Pulling a JournalSpace ... almost

Wednesday, I had this very friendly mail in my INBOX, from mdam:

QUOTE:

This is an automatically generated mail message from mdadm running on tosca

A Fail event had been detected on md device /dev/md1.

Faithfully yours, etc.


There was little reason to panic, since I had a spare disk installed already. A few man- and mdadm commands later, the array was resyncing. I walked away from the screen, confident that there was nothing to worry about.

How wrong could I be! Somewhere at 99% of the recovery process, one of the existing disks threw a read error. This was too much for md, and to punish me it marked two disks as spares, one as failed and only one as still working. RAID5 may be designed to deal with broken disks, but it does have its limits. ;-) This is where it got scary, especially since this machine is, say, 1300km away from me.

With some remote help, I managed to get the machine rebooted in single user mode with an sshd running. The disks were all available again, but the superblocks were sufficiently broken that md didn't want to construct the LVM array anymore. (Fortunately the rootfs array was not a problem!)

Anyway, I spent that night copying the raw partitions over to another machine. Tried to construct an array there, but things were untable, md often tried to resync the partitions (bad idea), or simply didn't want to run it for me. Instead of trying to make this go, I decided to write a little tool to do the dirty work for me. And that, reader, is why I'm writing this. :-)

To my surprise, I couldn't find any tool to do this on FreshMeat. Sure, when I search for "RAID recovery" on Google, I get plenty of ads for "Professional RAID recovery tools", but I don't want to pay $$$$ for a program that XORs a couple of GBs of data for me. :-P

So, behold: raidrec. Comes with no documentation, other than this blog article and the (long) comment at the top of the file. I hope it'll be useful for someone some day... It was for me. I have all my data back, LVM picked up all my volumes perfectly, and a few fscks later I managed to migrate all my VMs to OpenVZ running on a desktop elsewhere in the house. At least ruby (my workstation here in Dublin) isn't the only desktop machine being a part-time gaast.net webserver anymore. :-/

If anyone didn't get the JournalSpace reference (which fortunately isn't very accurate here anyway): http://journalspace.com/

F-Spot "plugin" for printing pictures via PhotoPrintIt

A little while ago I wrote a little Perl script that can be used to upload a bunch of pictures to PhotoPrintIt (Dutch people may know this from the shop Kruidvat). Together with a tiny .dll file this can be used as an F-Spot plugin to get pictures printed. Just select the ones you like in the picture browser, File->Export->Printing Service, wait for a little while, enter your address information and you're done. 2/3 days later you can collect your pictures at a local shop (or they'll be shipped to your home).

I'm not actually using this myself and don't intend to support it or spend a lot more time on improving it (not to mention adding a GUI), but maybe even in the current form it's already useful to someone. Just get the source using bzr: http://wilmer.gaast.net/downloads/printpics/.

Unbricking your Netgear ADSL router without Windows

So for about a year I have a DSL modem and a separate router (running OpenWRT) here. Simply because the average DSL router has crappy software (no decent CLI, connection tracking for nothing more complicated than TCP and for only a few hundred of them, crappy wireless ... well, you get the point). So I decided to buy a Linux-powered DSL router, the Netgear DG834G. I hoped for one with an AR7 board, because that one seems very well supported, but I received a v4 which has a Broadcom board instead. :-(

Anyway, Netgear is still pretty decent. The stock firmware comes with a telnetd (must be activated via the webserver though), and (well, forced by the GPL) they put tools on-line which I can use to rebuild firmware images, which I already abused to remove the multi-lingual web interface and use those precious kilobytes for a tcpdump binary instead. :-) Adding a kernel with IPv6 support is going to be more complicated though.

Anyway, I should first focus on making the thing actually wortk with my IPoA ADSL2+ connection.... sigh

But after bricking the thing once I did manage to write up a tool (based on a half-finished tool written by someone on the OpenWRT forum) to fix that very problem. These routers can be reflashed without any serial cable or whatever these days, using the power of raw Ethernet frames (R). It's a gross hack, but it works and is reasonably convenient. It's up for download for anyone who needs it. Be careful, only use it when things can't get any worse anyway!

Oxegen 2008

As Jelmer already said, Irish people rock. Spent last weekend at the Oxegen festival, and I really meant to write something about it, so that's what I'm doing now. :-)

A little while ago Jelena saw an ad about Oxegen on TV. As soon as I heard of it, I checked the lineup and got as happy as a four-year-old kid on his birthday. I absolutely had to go there! Until then I really had the impression none of the bands I care about ever come here but just to the UK. Turns out I was wrong.

Aphex Twin was there, the schedule promised a half-an-hour gig, which turns out to be a whopping ninety minutes of, errrm, eargasm. And of course RATM on Sunday evening was great. But what we both really liked were the people. Some say that at Lowlands everyone's your best friend. Sure, the atmosphere there is nice, but still, it's a festival full of closed and shy Dutch people who live for themselves. :-P

The Irish at Oxegen, however, were absolutely lovely. Everyone seems to know you. People are more open (like how people here are anyway, especially outside Dublin), kinder. Random people walk greet you and/or want high fives, especially after good gigs. Of course the free hugs, people who ask how tall I may be (complaints about my hairs also appeared near the end of the festival, but I must admit my hair "styling" doesn't really improve from not seeing any shampoo for four days ;-)), someone even asked if we were maybe speaking Finnish (I guess this was the first time he heard Dutch)... At the Seasick Steve concert I helped someone to make one movie, since it was easier for me to hold his camera high enough to actually see something. The guy thanked me at least three times. :-D At Lowlands, where everone's supposed to be "your best friend", nobody trusts you enough to hold his/her camera in the first place...

The camping really never "slept", many people had a guitar with them, everyone speaks with a great accent, neighbours who explained us how to say "Shut up" and "Kiss my ass" in Gaelic. And of course, at the end of the festival, most people were too lazy to actually clean up their tent. We left a camping that was so full of tents, but otherwise so empty...

It was fantastic. Just a little bit expensive. More than 200 euros for the ticket. Any decent food costed at least seven euros. You even had to pay ten euros to get a programme (which was 50% advertisements). A beer costed eight euros (although you could get three back if you return the cup) There were lots of security folks on-site, I suppose a lot of the money went to them. Even at the campings there was always a security person on every 50 (?) meters. Not that they could prevent some tent graffiti and camping fights from happening, but okay...

Maybe the most amazing thing was that, even though this was a festival with almost 80k visitors, we never ever ever had to queue for ANYTHING. Well, okay, we had to wait for a few minutes to enter the supermarket once, but once we were inside everything went very smoothly, and we were back in the tent in no-time with some buns and slices of cheese (much better/lighter on the stomach for breakfast than the hotdogs most people were eating).

Anyway, it was absolutely great, and well worth the extra money. I can go on about this for ages, but I should be sleeping now. Thanks for reading this until the last line. ;-)