Archive for the 'Hacks' Category

Concatenate image tiles to larger image

Thursday, June 7th, 2007

Often sites display larger images split up in tiles of e.g. 256×256 pixels. The tiles can easily be retrieved using e.g. curl. The full image can be reconstructed using ImageMagick montage:

montage +frame +shadow +label -tile NxM -geometry +0+0 *.jpg joined.jpg

where N is the number of horizontal tiles and M is the number of vertical tiles.

Move songs between iTunes libraries

Thursday, March 9th, 2006

I could not find an easy way to move songs from one iTunes library to another. After some searching and trial and error, I settled on the following.
Read the rest of this entry »

Switching between several iTunes libraries

Thursday, March 9th, 2006

I wanted to distribute my mp3 collection over several drives, which is not well supported by iTunes. The article Switch between two iTunes Libraries describes an approach how to set this up, but this is a bit too complicated. Here is my approach.
Read the rest of this entry »

Select random picture

Thursday, November 24th, 2005

The following command selects a random picture from the directory for the current year, copies it to the file random.jpg and stores the path in file.txt.

#!/bin/sh
cd $HOME/public_html/images
year=`date +\"%Y\"`
file=`/usr/X11R6/bin/xscreensaver-getimage-file --name $year`
cp $file random.jpg
echo $file > file.txt

It can be used to generate a random background image by e.g. running it as a hourly cron job.

AWStats Browsers

Tuesday, May 3rd, 2005

This is an adaptation of the AWStats Totals PHP script to give an overview of browser usage over multiple sites on the same host.

Repairing a broken disk volume on a Mac

Wednesday, December 1st, 2004

One of my Lacie firewire drives would not mount, and disk utility failed to repair it. I am running Mac OS X 1.2.8. Googling gives some pointers to commercial programs like Disk Warrier and Disk Rescue, but this thread gives a fast solution. Read the rest of this entry »

Redirecting a web site

Friday, November 19th, 2004

I was moving a web site from my ISP, which just serves plain HTML pages, to my own server, where I have full control. This shell script replaces all HTML pages on the old web site by a redirect to the new web site (and saves a copy of the old page). Read the rest of this entry »

Script to convert Postscript to PDF

Friday, November 5th, 2004

I needed to convert lots of Word files to PDF. This script automates the second step, convert Postscript to PDF. Read the rest of this entry »

Script to convert Word to Postscript

Friday, November 5th, 2004

I needed to convert lots of Word documents to PDF. This script automates the first step, going from Word to Postscript. Read the rest of this entry »

Simple editing of plugin options in WortdPress

Saturday, September 11th, 2004

WordPress 1.2 has a simple built-in mechanism to generate an edit form with all options from one particular group. Unfortunately this has been removed in the CVS version. I hope that something similar will still be possible in the final 1.3 version… Read the rest of this entry »