Lars Wirzenius: Random hacks, 2003

Contents

Wednesday, December 31, 2003

Random hacks: New web page colors

I got a sudden inspiration to play with colors for my web pages and abandon the black-on-white look. I blame Janka for this, since she was playing with hers a few days ago. In the process I unified my CSS stylesheets so that most pages now use the same one. The exceptions are mostly web galleries of photographs and such, which are generated by Lodju and aren't supposed to follow the look of the rest of my pages.

I'm not sure I'll the new look when I wake up, but we'll see.

I also set the line-height attribute for most text to be 1.3, instead of the default 1, so that lines are a bit less tightly packed. I hope this improves readability.

Friday, December 12, 2003

Random hacks: GdkPixbuf rotation

There's been some action on Gnome bug 95865, which I opened a year ago, regarding getting a function to rotate a GdkPixbuf into Gtk+. When I first reported the bug, I only provided code to do the simple things (rotations in multiples of 90 degrees), but have since written code to do arbitrary rotations. Perhaps it will go in some day.

I wrote the simple rotation for Lodju, and Lodju is happy with the simple stuff, so I haven't been maintaining the arbitrary rotation code. Hopefully it still works.

Tuesday, December 2, 2003

Random hacks: URL escaping does not protect from spam

Six months ago, on June 3, several people claimed that hiding e-mail addresses on web pages would be as easy as encoding, say, the at sign ('@') using URL escape codes ('%40'). I decided to conduct an experiment, and added two addresses to my home page. Neither address had ever existed before. I obfuscated one in the manner suggested, and not the other. I also put in a filter to put all mails to either address to a special folder, which I've kept since.

I first reported on the results on June 14, eleven days later. Both addresses got their first spam then. Since then, I've received a total of 58 spams. All of them have been sent to at least the obfuscated address.

Anyway, the whole URL encoding idea is ridiculous to anyone with half a brain. Since the encoding is well standardized and easily undone, even a spammer with the IQ of George W. Bush will figure it out.

The original claim arose in the context of public web archives of mailing lists. To many people (including myself) it is more important that valid communication reaches us than that spam is prevented. Removing addresses from archives, or obfuscating them in ways that are tricky to undo, means that some valid communication fails to reach us. On the other hand, keeping addresses in cleartext does increase the amount of spam. Neither option is very good, at the moment, and the choice between them is difficult. It would be nice if a simple obfuscation such as URL encoding would work, but it doesn't.

Tuesday, November 4, 2003

Random hacks: Kirjavaliot fortune cookies

Niksu maintains Kirjavaliot, a list of humorous one-liner summaries of literary works. (In Finnish, sorry.) I wrote a small XSLT script and Makefile to convert the raw XML data file to a data file for fortune. Not the world's most useful thing, but fun.

Henri Charriere, Papillon: Vanki karkaa. Vanki karkaa. Vanki karkaa. Vanki karkaa. (_1_)

See my programs page for the code.

Wednesday, October 29, 2003

Random hacks: DVD price comparison

Spent a couple of hours tonight browsing various web stores and comparing prices for DVDs. To make comparisons and note keeping easier, I wrote a spreadsheet, and then added some additional stuff to make sure the prices were converted correctly to euros, and that postage and packaging costs and customs fees are included. Now I can easily see, for example, that at the moment the cheapest place to order season 6 of Buffy the vampire slayer is from Amazon.com, but it won't be available anytime soon, so if I want it now, I should order it from Ezydvd.com.au.

I only have a handful of stores and I look up and enter the data manually. If I was really serious about this, I'd write an application to fetch the data automatically and compare things properly. That's much too much work, however. Presumably someone else has done it already, but I'm happy enough with this simple thing.

Sunday, October 26, 2003

Random hacks: Log by category

I wrote a small Python program to split the main log pages, written by hand in XHTML, into section specific ones. Perhaps it is useful for some people.

This is something that at least some of the fancy web applications for logs do automatically, but I'm still uninterested in using them.

Sunday, September 7, 2003

Random hacks: Weeding out spam from mail archives

I've spent several hours of yesterday and today weeding out spam from two years' worth of mail archives. The archive is now some fifty or sixty thousand messages smaller, which is nice. I reclaimed some disk space as well. I guess I could have spent the hours more productively by hacking, but I didn't feel very energetic, and this was better than watching IRC and feeling numb.

On the other hand, I could have been reading a book.


Random hacks: Gallery installation failed

Tried to install Gallery, a PHP thingy for making on-line galleries, on the prototype ISP server. Everything went well until, except it took ages to upload and process a single photograph, and then it wouldn't even show it to me. The files on disk seemed perfectly OK, though. I probably screwed something up while configuring, but I didn't want it badly enough to debug it, so I just removed the whole thing instead.

On the other hand, I've seen Gallery in operation on a number of other sites, and it seems like a decent enough application. I'm thinking Lodju should support it, by being able to export files in a form that Gallery will accept with the least amount of trouble. Possibly even creating captions in Lodju and having Gallery understand them, as well. We'll see.

Friday, September 5, 2003

Random hacks: Setting up server for friends

I set up a new server at home for other people to use.

In my circle of friends, there are several who would like to have a traditional Unix server, where you log in and do stuff (read mail and news, mostly, possibly IRC under a screen instance) and keep your web pages. They have this from their university, for now, but are looking for other places, for various reasons.

They could set up their own server at the end of an ADSL pipe, but it requires effort and know-how they might not have. Lynoure, Killeri, and I got the obvious idea that we could help them by setting up a server for them.

We plan to keep things simple, and concentrate on simple basic services that just work. There will be a small monthly fee involved. Partly the fee will cover use of bandwidth and electricity, partly it will go into saving for eventual hardware investments, and partly it is compensation for the efforts. Rich we won't be, but I'll be happy if I can get a nice restaurant meal per month out of this. On the other hand, if there is not enough interest, and we stop doing this, then there's no harm done, either.

We're now in the prototype stage: the server is up and running and has a couple of test users who are willing to try things out and tell us of any problems and wishes they have. After a few weeks of this, we can decide whether we want to do this for real. It will be interesting.

Wednesday, June 18, 2003

Random hacks: Broadcast nethack

I have several friends who like to play nethack, and they like to talk about their games on the IRC channel we frequent together. One day they idly discussed how they could watch each other's games. I was feeling bored and hacked up a small Python program to do that. The player uses tee and netcat to send the output of his nethack to my program, and the others connect to my program via telnet. My program receives nethack's output and broadcasts it to all watchers. A simple exercise in network programming.

Now they're enthusiastic about it. I'm scared.

Saturday, June 14, 2003

Random hacks: Transcode problems

Transcode, which I use to convert captured video to mpeg, seems to stop after one hour and ten minutes. I have no idea why. So far, I've only converted episodes of TV series, which are less than an hour, but as soon as I tried a movie, I had trouble. Things are never simple, are they?

Sunday, June 8, 2003

Random hacks: Converting VHS to CD-R

I set up a tv-card for my desktop machine and connected my VCR to it. Then I set up Linux's video4linux subsystem, xawtv and streamer so that I could capture things to a file (an .avi containing mjpeg). Then, using transcode I convert the files to smaller ones (.avi containing mpeg). This way, I can get about an hour of video on a CD-ROM worth of data. Eventually, I hope to convert all my tapes to files so that I reclaim some shelf space.