Wednesday, October 04, 2006

Low level flight through Paris

One August morning in 1976, French filmmaker Claude Lelouch mounted a camera on the front bumper of his Ferrari 275GTB and had a friend, a F1 driver, rip through the streets of Paris.

I heard about the famed cult video ages ago and finally found it! You can even follow the adventure in realtime on this Google Maps mashup.

Running 18 red lights, and reckless driving got Lelouch arrested after he screened the video. He however claimed that he had taken adequate precautions. He further protected the identity of this friend, the driver.

Since the car is never revealed in the video, the usual suspects were a series of exotics -- 275GTB, Alpine A110, or even a Matara 675.

Wild speculation aside, Lelouch recently confessed that he was driving his own 6.9L Mercedes and tapped over the audio from a 275GTB. The car never exceeded 145kmph. I wish he never said the truth... imagination is better than reality.

The Ghost Rider offers solace.

My best long distance run has been the 530 kms from Kodai to Chennai in 6 hrs 30 mins. Short distances runs inside Chennai is my regular return from work drive, from the Thousand Lights Mosque area to Adyar in a tad over 7 mins.

Friday, September 08, 2006

Shuffle without iTunes

I bought an iPod Shuffle some time in July 2005 and was immediately annoyed because it worked only with iTunes. In my opinion, the sanest way to download content to a USB attached audio player is to make the device available as a USB Mass Storage Device and just copy files to it as you would on a USB memory stick. Salvation was not far away...

Googlemancy revealed that Martin Fiedler's shuffle-db Python script would allow me to dispense with iTunes entirely. The only shortfall with shuffle-db was that it required your computer to have Python installed. While most Linuxen come with Python, Windows boxes typically don't. I used the excellent py2exe extension and compiled shuffle-db script into standalone executables, shuffle-db-0.7-pre1.zip and shuffle-db-1.0-rc1-winxp.zip are both available. The 0.7-pre1 release should work on Win2k/XPwhile the 1.0-rc1 release has been tested on WinXP SP2 only.

If you have iTunes, this is good time to uninstall it. Plug in your Shuffle and it should appear as a regular USB Removable Storage Device. If your Shuffle is unused, you need to initialize it correctly before proceeding. The "Usage" section of the shuffle-db website has details.

Unzip the files into the root directory of your Shuffle. My Shuffle is mounted as the F: and this may be different on your box, so ensure that the runme shortcut points to rebuild_db.exe.

If you are on a non-Windows platform and have Python installed, you can still use shuffle-db, by running python rebuild_db.py.

Copy/delete mp3 files to/from any folder on the Shuffle. Before disconnecting the Shuffle from your computer, double click the runme shortcut. This runs rebuild_db.exe and recreates the necessary index. That's all there is to it!

Note that shuffle-db silently ignores non audio files, and the iPod can be used as a USB memory stick as well.

Thursday, September 07, 2006

GMail as smarthost for FreeBSD-6.1 Sendmail

Update: This does not work!! FreeBSD 6.1 sendmail does not include TLS (GNU TLS or SSL), so you need to recompile sendmail with TLS support. Easier still is to install Exim 4 from ports that supports all we need.


I run a FreeBSD 6.1 box at home and want to send emails from it by using GMail as my mail relay (smarthost). GMail provides secure mail relaying by using SMTP AUTH and TLS. Hence this setup will work for DSL users on a dynamic IP addresses as well as mobile users.

Here is how you go about setting up all this:

Step 0: DNS settings

If you don't have a fully qualified DNS entry for your box, sendmail will have trouble starting up. I have a Dynamic DNS domain mithila.ath.cx and it's wild carded, ie. *.mithila.ath.cx will all point to mithila.ath.cx. My /etc/resolv.conf looks like this:
search mithila.ath.cx
nameserver 208.67.222.222
nameserver 208.67.220.220
I use OpenDNS as my servers because my ISP DNS servers are unreliable.

Step 1: Editing freebsd.mc

Edit /etc/mail/freebsd.mc and add the following lines to the bottom of the file:

define(`SMART_HOST',`smtp.gmail.com')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
define(`CERT_DIR', `MAIL_SETTINGS_DIR`'certs')
define(`confCACERT_PATH', `CERT_DIR')
define(`confCACERT', `CERT_DIR/CAcert.pem')
define(`confSERVER_CERT', `CERT_DIR/mycert.pem')
define(`confSERVER_KEY', `CERT_DIR/mykey.pem')
define(`confCLIENT_CERT', `CERT_DIR/mycert.pem')
define(`confCLIENT_KEY', `CERT_DIR/mykey.pem')

Step 2: Create client-info with your gmail username/password

[root@mithila /etc/mail] mkdir /etc/mail/auth
[root@mithila /etc/mail] touch /etc/mail/auth/client-info
The contents of /etc/mail/auth/client-info is a single line:
[root@mithila /etc/mail/auth]# cat client-info
AuthInfo:smtp.gmail.com "U:root" "I:GMAILUSER@gmail.com" "P:PASSWORD"
Replace GMAILUSER with your gmail username and PASSWORD with your gmail password. Note that you are storing your gmail password in clear text, so please take the necessary precautions.

To create the client-info hash, run the following:
[root@mithila /etc/mail/auth] makemap hash client-info < client-info

Finish this step by fixing the ownership and permission on your files (sendmail is picky about this):
[root@mithila /etc/mail/auth] chown -R root:wheel /etc/mail/auth
[root@mithila /etc/mail/auth] chmod 700 /etc/mail/auth
[root@mithila /etc/mail/auth] chmod 600 /etc/mail/auth/*

Step 3: Creating SSL certs

The OpenBSD starttls(8) manpage has an excellent walkthrough for creating an SSL certs. Following is just a repeat of the relevant bits of the manpage.

[root@mithila /etc/mail] mkdir /etc/mail/certs
[root@mithila /etc/mail] cd certs
[root@mithila /etc/mail/certs] openssl dsaparam 1024 -out dsa1024.pem
[root@mithila /etc/mail/certs] openssl req -x509 -nodes -days 3650 -newkey dsa:dsa1024.pem -out /etc/mail/certs/mycert.pem -keyout /etc/mail/certs/mykey.pem
[root@mithila /etc/mail/certs] ln -s /etc/mail/certs/mycert.pem /etc/mail/certs/CAcert.pem
[root@mithila /etc/mail/certs] openssl req -x509 -new -days 3650 -key /etc/mail/certs/mykey.pem -out /etc/mail/certs/mycert.pem

Remove temporary files and fix ownership and permissions:

[root@mithila /etc/mail/certs] rm dsa1024.pem
[root@mithila /etc/mail/certs] chown -R root:wheel .
[root@mithila /etc/mail/certs] chmod 700 .
[root@mithila /etc/mail/certs] chmod 600 *

Step 4: Create new sendmail.cf

[root@mithila /etc/mail] make; make install
[root@mithila /etc/mail] /etc/rc.d/sendmail stop
[root@mithila /etc/mail] /etc/rc.d/sendmail start 
Watch /var/log/maillog for errors when sendmail is restarted.

Step 5: send test email

[rsubr@mithila ~] mail -s 'MAILTEST' GMAILUSER@gmail.com < /etc/motd
[rsubr@mithila ~] mail -s 'MAILTEST' username@domain.com < /etc/motd
Watch /var/log/maillog for errors. That's all folks!

Issues

Ensure that your box is capable of resolving MX records for domains.
[rsubr@mithila ~] dig -t mx gmail.com
For some strange reason, my DSL router did not want to resolve mx records, and sendmail barfed. Using the right DNS servers in /etc/resolv.conf should do the trick, or you could just run named and point DNS to localhost. I chose the former, and since my ISP (Airtel) has unreliable DNS servers, I use the OpenDNS servers 208.67.222.222, 208.67.220.220.

Tuesday, September 05, 2006

Electric Sheep

Do androids dream of electric sheep? What does your computer dream about? Spot Draves started the Electric Sheep project in 1999 that enabled tens of thousands of computers to collectively dream. The Dreams in High Fidelity website has high resolution computer dreams. There are dozens beautiful images from the archive.

Sunday, September 03, 2006

Race to the clouds

A video of Monster Tajima's latest attempt at conquering Pikes Peak showed up on YouTube recently. Monster was announced the overall winner and Suzuki Sport website has more.

YouTube also has the Climb Dance video of Ari Vatanen's 1998 attempt at taming the Mountain in a purpose built Peugeot 405-T16. Simply watching the video gives me the shivers! Ari is God.

Ari Vatanen: Our lives can't be judged by a stopwatch.

Thursday, August 31, 2006

Emerson's Success

Success
To laugh often and much;
to win the respect of intelligent people
and the affection of children;
to earn the appreciation of honest critics
and endure the betrayal of false friends;
to appreciate beauty; to find the best in others;
to leave the world a bit better,
whether by a healthy child,
a garden patch
or a redeemed social condition;
to know even one life has breathed easier
because you have lived.
This is to have succeeded.

This poem is often credited to Ralph Emerson, but there is some controversy around it.

Anyway, Emerson is my inspirational poet/author for September. rwe.org has the complete works of Emerson for free.

Monday, August 28, 2006

Creating custom OpenBSD ISOs

The OpenBSD project does not make CD images available for download. You need to purchase the official CD sets. If possible, please consider purchasing the official CDROMs and help fund the project.

That aside, here's how you can download a few files from ftp.openbsd.org and create your own custom OpenBSD 3.9 installation CD set. Any Unix or Windows system with an internet connection and mkisofs should be sufficient. The following procedure has been tested on i386 only.

  1. Create a base directory $OBSD that will hold the necessary files.
    1. export OBSD=/data/scratch/obsd
    2. mkdir $OBSD
  2. Visit ftp://ftp.openbsd.org/pub/OpenBSD/3.9 or your best mirror and download files from the i386 folder. Install.i386 contains the details on what needs to be downloaded. You should atleast download:
    1. To boot the installer you require bsd, bsd.rd, cd39.iso, cdboot, cdbr, cdemu39.iso
    2. The *.tgz files are the installation sets. Basic requirement (without X11) is: base39.tgz, comp39.tgz, etc39.tgz, man39.tgz, misc39.tgz.
    3. If you want to install X11, grab all the x*.tgz files as well.
  3. Your $OBSD folder should look like this:
    ./3.9
    ./3.9/i386
    ./3.9/i386/base39.tgz
    ./3.9/i386/bsd
    ./3.9/i386/bsd.rd
    ./3.9/i386/cd39.iso
    ./3.9/i386/cdboot
    ./3.9/i386/cdbr
    ./3.9/i386/cdemu39.iso
    ./3.9/i386/cdrom39.fs
    ./3.9/i386/comp39.tgz
    ./3.9/i386/etc39.tgz
    ./3.9/i386/man39.tgz
    ./3.9/i386/misc39.tgz
  4. It's also a good idea to grab source code and basic ports tree. Get sys.tar.gz, src.tar.gz, ports.tar.gz and copy them inside your $OBSD/3.9 directory.
  5. Change to the $OBSD folder and run mkisofs -vrTJV "OpenBSD39" -b 3.9/i386/cdrom39.fs -c boot.catalog -o obsd39.iso $OBSD
  6. Burn the resulting obsd39.iso image to a CD using your favourite CD burning software.
Win32 users can grab a native mkisofs.exe and build_cd.bat.

Sunday, March 19, 2006

Blogger UI

After much deliberation, I've started blogging.

Notice that Blogger's default page layouts can do with a lot of improvement. Most page layouts contain a small strip of content in the middle with excessive whitespace on both sides. On large displays this leads to poor readability. Increasing text size in Firefox (View-> Text Size or Ctrl + +/- shortcut keys) does not scale the content width, but only makes the fonts larger.

Some web developers seem to have the idea that if you want to view their web page sproperly, you go view it on their monitor and browser. Ugh!

Web pages are also user interfaces and should lend themselves to some extent of customization by the end user. This implies that web pages look good on any sane screen resolution, and allow the user to increase/decrease the font size as required. I often tend to increase the default text size - sometimes upto 12, 14 pt - for easier reading.

A good example of such a page is Gmail. Try increasing the font size in Gmail and see how all the HTML elements scale up neatly. Since the print version of most webpages are devoid of tables, ads, etc., they tend to scale nicely and I mostly end up reading the print version rather than the onscreen rendition.

The nice thing about Blogger however is that all this can be addressed. A look at the CSS (in the Blogger Template) shows that the content div is hardwired to some ~600px. I've modified the template for this blog so Firefox users can increase/decrease text size for their comfort. Take a look at the HTML source for this page for the changes.

Colors, I prefer a black background with yellowish text (rgb:255/255/200, #ffffc7). You monitor is a light source and reading black text on white background is akin to reading text written on a light bulb.

As for the fonts, I've pretty much settled on Trebuchet MS as my default variable width font and Lucida Sans as the fixed width font. For print I prefer Georgia. More information about selecting fonts is available in Andy Hume's excellent article The Anatomy of Web Fonts.

That's a good start - Hello world!