sysadmin

Bash inefficiency

I need to create 2 million entries in a mysql table for some testing. Figured I'd use a bash script. The script took 10 minutes to write, but would took 1min39s to create the SQL for just 5000 rows. Extended inserts made no difference. I spotted that I'd used md5sum to create dummy data. Removing that speeded it up to 49s. Removing some debugging echo statements got me to 39s.

Finally, I decided to rewrite it in Python. 0.2s!! Now there's optimisation for you, and a lesson in when not to use bash.

Running Selenium and fitnesse headless on RHEL5

Have just got Selenium running headless on a RHEL5 VM.

This is kinda-mad, selenium invokes a firefox instance, has it render pages, runs tests against it, then closes the firefox instance down. It does that for very test it runs (clean environment and all I guess). For firefox to run, we need it to think that an X server is running. For that, we use Xvfb.

As this was running on a 64 bit host, I needed to explicitly select the X86_64 version of Firefox, otherwise it would also try to download the i386 version, which would cause all sorts of conflicts.

Things get cloudy

I've heard folks talk about 'the cloud' as if it is a hollow marketing term. I have to say, after playing with Amazon EC2 for a while, I am rather impressed, and am busily watching my brain twist around it.

Before, servers were expensive. Not in the financial sense, but in the sense of the amount of work that they typically took to set up (request to provider, signing documents, commissioning, then configuring, etc). Now, once you've built an image, a click of a button will have another machine available.

Silly date things

Want to find out what date a unix epoch date refers to:

date --date=@1229593587

Want to go the other way? Find out the unix epoch time now? That's simple:

date +%s
 

Syndicate content