Missing mail command on Amazon’s Linux

I recently noticed that the mail command is not available by default on the latest version of Amazon’s Linux AMI (v2011.09). This functionality is available in the mailx package, which can be installed with the following: yum install mailx

Showing the Firebug icon

While it is easy enough to use F12 to display Firebug in Firefox, I just like the status bar icon. Unfortunately, it has been hidden in the last few releases of Firebug. To display it, open about:config, and set extensions.firebug.showStatusIcon to true.

Optimize all MySQL Tables

A one-liner to optimize all MySQL tables, in all databases. Be advised that running optimize on InnoDB does a ‘recreate and analyze’. Run as root in the example below. mysqlcheck -o -u root -p –all-databases

Verify that SSL caching is working

To verify that SSL caching is on, check the Session-ID across multiple sessions (i.e. resume/reconnect) – they should be the same: openssl s_client -host HOSTNAME -port 443 -reconnect | grep ‘Session-ID:’ The equivalent, using gnutls-cli should be: gnutls-cli -V -r HOSTNAME |grep ‘Session ID’

Rebuild Icon Cache

Recently, after upgrading a program (FileZilla in this case), the program’s icon would not display on the desktop (Windows 7). Even deleting and recreating the shortcut resulted in a broken icon (although, the shortcut itself worked fine). No amount of refreshing the desktop made a difference. The quick fix was to rebuild the icon cache,… Continue reading Rebuild Icon Cache

Prime Factoring with PHP

A surprisingly large number of math based computer problems appear to require factorization, finding prime number, or prime factoring. Presented below is a reasonably fast algorithm for prime factoring a number – it is limited to the integer size on PHP (231-1). It should be a fairly trivial exercise to modify the function below to… Continue reading Prime Factoring with PHP

Apache: Not GET Request

My error logs were recently filled with repetions of the the following line: [Date] [warn] [client IP] Not GET request: 2., referer: As it turned out this was caused by the mod_pagespeed module (from Google). Disabling it has stopped the errors, I will be trying out a newer version of the module shortly. Additional info:… Continue reading Apache: Not GET Request

Decoding a Base64 Email Attachment

I had a few files containing email attachments that needed to be converted into usable files. The following code (which has no checks in it), did the trick: <?php function decode_email_attachment(){ $data= file_get_contents($inputfile); file_put_contents($outputfile, base64_decode(str_replace( “\r\n”, “”, $data ))); } ?>


For many people the mere mention of fractions elicits a wince, and while these lovely math constructs played a notable role in our early years of math, they are reasonably simple entities. While most humans revisit fractions over many years and often still fail to grasp the concept, for a computer, the elementary operations with… Continue reading Fractions

Bundle Error on AWS

On servers running certain forms of chroot, a file system loop is created (in /var/named/chroot), causing errors when attempting to bundle the volume. This occurs in particular when running BIND (named). To successfully bundle the volume, simply stop named: sudo service named stop ec2-bundle-vol {options}

Setting the timezone on PHP

Versions of PHP after 5.10 include the date.timezone directive in php.ini. Many applications which reference time need this directive to be set. A list of accepted values can be found at: http://www.php.net/manual/en/timezones.php The timezone is set as a quoted string, with no delimiter at the end, for example: date.timezone = “Continent/City” The location of the… Continue reading Setting the timezone on PHP

Time on AWS Linux AMI

The time on the Amazon Linux AMI is set, by default to UTC. To change this, symlink one of the timezone files from /usr/share/zoneinfo/ to /etc/localtime. The change takes effect immediately (and will also affect most logs, etc). For example: ln -sf /usr/share/zoneinfo/EST5EDT /etc/localtime To make the change persist through updates, it is necessary to… Continue reading Time on AWS Linux AMI