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

Using a SATA hard drive through IDE – Part 1

One of the older computers I have around is from before the SATA era – it only supports IDE. Unfortunately, most new hard-drives are SATA, especially those of reasonable sizes (250GB, 500GB, etc). This machine previously had only about 60GB, which was insufficient for its purposes. I find external hard-drives to be impractical for day-to-day… Continue reading Using a SATA hard drive through IDE – Part 1

PuTTY SSH

Having used PuTTY a lot over the past few years, I have often found it to have a few default settings that are rather annoying: Firstly, the colours – I never seem to be able to make out dark blue on black Change ‘ANSI Blue’ and ‘ANSI Bold Blue’ under Window > Colours Secondly, the… Continue reading PuTTY SSH

Installing mcrypt (PHP) on AWS Linux AMI

Update: with the update of PHP to v5.3.3, the amzn repository now includes php-mcrypt, rendering the steps below unnecessary. At the moment, the amzn repository has v5.3.2 of PHP (while the latest version is v5.3.3) – it also does not offer php-mcrypt. While in previous servers I have included a wider selection of repositories, I… Continue reading Installing mcrypt (PHP) on AWS Linux AMI

Installing APC on AWS Linux AMI

Update: Current versions of Amazon’s Linux AMI include the package php-pecl-apc (v3.1.9 – the same as the latest from PECL) in the repository. Using a package manager is usually preferable to using PECL- it will help you keep up to date, is centrally managed, and minimizes unnecessary dependencies (especially build tools). APC can be installed… Continue reading Installing APC on AWS Linux AMI

Coding with DNA

Alright, this one isn’t quite as exciting as the title suggests. I had the need of a quick script for a bit of biology – genetics. Pretty simple stuff really, but I thought I would post it anyway. Generating random sequences of DNA function randdna($len){ $length=intval($len); $bases=array(‘A’,’C’,’G’,’T’); $dna=””; for ($i=0; $i<$length;$i++){ $dna .=$bases[mt_rand(0,3)]; } return… Continue reading Coding with DNA

Full Text Searching

For one reason or the other, I have often had a need to find matches in large data sets, usually containing significant quantities of text. One example was a 100k chapters of stories (totaling about 1.5Gb, unformatted) that I wanted to be able to search. While this is quite small when compared to even the… Continue reading Full Text Searching

Change Permissions of Specific File Types

To change the file permissions for all PHP files to 754: find . -type f -name ‘*.php’ -exec chmod 754 {} \; To find all files with permissions 754: find . -perm -754 To find all files that are not writable by the owner: find . ! -perm -u+w

Fix Line Breaks

To convert all files: $ find . -type f -name -exec dos2unix {} \; To convert specific files (by type): $ find . -type f \( -name “*.php” -o -name “*.txt” -o -name “*.css” \) -exec dos2unix {} \;

On the obsolescence of the Human species

Humans aren’t the fastest, strongest, biggest, smallest, or most efficient creatures. The only advantage we have is a well developed cerebral cortex. Of course, superior intellect can allow us to compensate for the areas which we lack. We currently have a problem with said superior intellect however. If we are unable to evolve to overcome… Continue reading On the obsolescence of the Human species

Living Networks

The average person is likely to consider computers to be simply tools to accomplish a task – inanimate silicon circuits. But, is that entirely true? I recently encountered an instance where network connectivity had dropped considerably, but appeared to be gradually improving without anyone doing anything to actually address the problem. It was mentioned to… Continue reading Living Networks

Diagnosing a computer that won’t POST

Today, I was asked to diagnose a computer that wouldn’t POST over the phone. POST is the power-on self-test – it is self-check cycle that the computer goes through before ‘starting’ – it usually checks the motherboard (for short circuits), CPU, RAM, and graphics card for some basic level of functionality. Basically, this computer would… Continue reading Diagnosing a computer that won’t POST