For my new website I have been working on for a while I want to generate an image of the waveform of all audio files uploaded on the server. A trip down google avenue quickly led me to this post on andrewfreiday.com. He describes his search for the very same and comes up with a solution using lame to convert the mp3 file to a wave file and a php script to generate the image. I’m going to use his approach and couldn’t resist rewriting the script.

You can download my script for generating a waveform. It is licensed under the Apache License v2.0 because the original script was (I usually don’t bother with a license).

Continue reading »

After discovering I didn’t backup everything on my server before the hard disk was replaced I realized how much I love  procmail, especially the rule that adds a reply-to header to several mailing lists. Technically they aren’t mailinglists but just lists, thanks to Google Apps used by my student association. Fortunately I bragged about it on Facebook several months ago so after checking my old wall posts (not a pleasant job because it was months and months of posts) I found it.

I did fix my backup scripts but just to be sure, and maybe to make someone else happy I’m posting it here:

# Add reply-to to those pesky example.com mailinglists.
:0 fhw
* ^List-Id:\/.*\.example\.com
|formail -I "Reply-To: `echo $MATCH | \
sed -e 's/^.*\>\(.*\)\.example\.com.*$/\1@example.com/'`"

# Other ppl without cool procmail rules press reply-all
# so delete all to <lists>@example.com msgs cc'd to me
:0
* ^TO_(list_name|another_list|yet_another_list)@example.com
* !^List-Id:\/.*\.example\.com
/dev/null

Update: I’ve added a second rule to delete all mail that is addressed to the mailing list (using *@example.com won’t work because there are also non-list adresses at that domain) but has no list-id and therefor must be a cc to me, not the list, because few people have these cool filters and most just press reply-all to make sure it is at least delivered to the list. Sigh. I’m still monitoring this rule in case of errors but it seems to work fine. You can replace /dev/null with your trash folder if you want to be less rigorous.

I don’t pay much attention to my hard disk usage nor do I remember to periodically empty the trash. In fact, I don’t want to empty the trash as long as the disk space is available because you never know when to need to restore a trashed file.

To keep track of my disk usage I made a simple bash script that determines the free space and size of the trash and sends a Growl notification if the disk space is running low or the trash is to big (absolute or proportional to the free space available) and set my crontab to run it every 15 minutes. Continue reading »

Source codeMy WordPress powered website has been running for quite some time now, and today I finally replaced the default theme with something I like better,  Suffusion, and customized it to my needs.

I had installed some syntax highlighting plugins before but disabled them because I couldn’t get it to work properly. Now with the pretty new layout all posts with snippets of unhighlighted source code were a real eye-sore, so that needed to be fixed as wel.

Continue reading »

I’d like to use PDO in conjunction with MySQL, but in the PHP installation shipped with OS X by default only pdo_sqlite is enabled. I do not want to compile my own Apache or PHP so the way to go is to simply add the pdo_mysql module. I followed these instructions but after running phpize there were some warings on my screen and no makefile to be found. My current PHP version is 5.2.8 and I used the source of 5.3.0, so I tried again with 5.2.10 (since no other version was available at the PHP download page). Both yield the same result, namely that it compiles, installs and won’t start.

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so' - (null) in Unknown on line 0

Following instructions in the comment to remove all architectures but the x86_64 have no effect. I think I have to compile my own PHP installation and have apache use that. Which sucks so much I decided to just wait for Snow Leopard and pray that either pdo_mysql is installed or dynamicly loading libraries is allowed there. I am happy to inform you all that the first is the case. Hurray!

The svn commandline tool is great, but when I don’t receive a e-mail notifying me of a new commit I hardly ever read the log messages. That’s why I added an alias to my profile called svnup which does an update and then prints the log from the revision before the update to now.

SVN_CURR_REV=`svn info|grep 'Last Changed Rev'|awk '{ print $4 }'`; \
svn up; \
svn log -r $SVN_CURR_REV:HEAD

Now I just have to remember tot type svnup instead of svn up.

© 2011 Ronald! Suffusion theme by Sayontan Sinha