Howto create a youtube video from mp3/ogg audio using a picture

If you want to create a youtube video from an audio file, here is how to do this.
All you need is the audio file, a single picture, and ffmpeg.

First find out the lenght of the audio file in seconds, you'll need it. Here is an example with a 420 seconds file:

ffmpeg -loop_input -i picture.jpg -vcodec mpeg4 -r 25.00 -qscale 2 -s 480x360 \
-i audiofile.mp3 -acodec libmp3lame -ab 128k -t 420 video.avi

This will create a Hi-Res MPEG-4 video with 128k audio. The trick here is to use that one picture and loop it for -t seconds.

Howto print text between tags or characters with awk or sed

Took me a while to figure out this one. All I wanted to do is to print the text between two tags/characters/strings.

The IMHO nicer Awk way:

$ echo "bla(foo)"|awk -F'[(|)]' '{print $2}'
foo
$ echo "bla=@@foo@@"|awk -F'[@@|@@]' '{print $3}'
foo

 and with sed:

$ echo "blah(foo)"|sed -n 's/.*(\([^ ]*\))/\1/p'
foo
echo "aaafoobbb"|sed -n 's/.*aaa\([^ ]*\)bbb/\1/p'
foo

Figured.

Howto control Tomcat using wget

I just had to restart a webapp in Tomcat without stopping a second app running in the same tomcat instance.

Usually this can be done easily via the Tomcat Manager, but in this case I was not able to access the Manager due to firewall rules. Though I was able to access the server using ssh, but there was no curl installed.

Luckily wget did the trick too!

Howto import SAR data into a PostgreSQL database and create graphs in OpenOffice.org

This is a walkthrough on how to get SAR data into a database, and use OpenOffice.org to create nice graphs using a JDBC connection to that database, and SUN Report Builder to do the graphs.

In this example I will use SAR's CPU utilisation data.

Software used:

Overlay with Qt 4.5 snapshot ebuilds

Recently stumbled over this blog post: http://labs.trolltech.com/blogs/2008/12/04/how-kde-4-is-blocking-qt-45/

Looks like it's usable for KDE 4 trunk already, and the improvements to the WebKit engine got me interested in trying it. So I spend 2 hours in creating ebuilds for the Qt 4.5 snapshots - based on the split Qt 4.4.2 ebuilds in portage.

Howto: Log firewall from OpenWrt to a remote rsyslog

This is how I got remote logging from my OpenWrt router to the syslog daemon on the server box.

On the server side, I enabled remote logging over UDP (refer to the rsyslog or syslog-ng documentation).

On the OpenWRT box following steps are needed

Enable remote syslog logging

Edit /etc/config/system and enable remote logging by adding:

option 'log_ip' '192.168.1.2'

Now reboot the router and see if it logs correctly.

Solaris and DNS

Just that I'll never have to google this one up again....

To get Solaris to make use of your ususal DNS

cp /etc/nsswitch.conf /etc/nsswitch.conf.orig
cp /etc/nsswitch.dns /etc/nsswitch.conf
echo "nameserver xxx.yyy.zzz.bla" >> /etc/resolv.conf
svcadm restart nscd

There we go.