Archive for September, 2005

Emacs wiki

Sunday, September 18th, 2005

I just stumbled upon http://www.emacswiki.org/cgi-bin/wiki/SiteMap, which looks like a very nice place.

I found a newer version of longlines.el, for example.

Converting AAC audio files to mp3

Monday, September 12th, 2005

This command will convert an AAC audio file to an mp3 audio file:

ffmpeg -i input.m4a -acodec mp3 -ac 2 -ab 128 output.mp3

Batch conversion can be done with

for i in *.m4a; do 
    ffmpeg -i "$i" -acodec mp3 -ac 2 -ab 128 "${i%m4a}mp3"; 
done

Sometimes it really is simple :-)

Longest Common Prefix in perl

Friday, September 9th, 2005

I can’t help finding this slightly elegant. Unfortunately I no longer remember where the idea came from.

#!/usr/bin/perl

use strict;
use warnings;

sub longest_common_prefix {
    my $prefix = shift;
    for (@_) {
	chop $prefix while (! /^$prefix/);
    }
    return $prefix;
}

print longest_common_prefix(@ARGV), "
";