Recent Blog Posts

Good reference!

awk idioms

April 18th, 2015  Read more ...

Just stumpled upon a great resource on Stackoverflow that lists a couple of really nice awk idioms related to printing N lines after some matching line in a text.

Nice Answer!

Sometimes it is nice to inject the output of a shell command into the current text, like the current and time.
During search for a regex that matches an IP address accurately I found [this article][1] which is the first result on google. The article shows a regular expression for accurate matching but it is not correct. This article show a correct implementation for the PCRE engine.

Today I stumpled upon a great old answer on stackoverflow. @MarkBaker showed an implementation of the common distribution functions in PHP.

Don’t miss to upvote him :)

I've often seen solutions which are creating a temporary file using `tempnam()`. However, this solution still needs all contents written to a file first and then, in a second step, reading again using `file_get_contents()`. Also it needs to be sure that the file will be removed after operations, ... I mean *ensured*! ;) Here I will show an alternative ...

Science of Sound

Januar 25th, 2014  Read more ...

Today I accidently made a typo when issuing the `ls` command on an Ubuntu server. The shell returned: The application >>sl<< is currently not installed. You can install it using ... Oh cool! What's that? A tool named `sl` ?


When automating mysqldump it is necessary to pass authentication information along with the command. While you can pass the credentials on the command line this is considered unsafe as the password would be visible to all users using the ps afx command (for example). A workaround for this is using expect a program that is meant to automate user interaction for terminal programs. IT simulates a tty and passes input to the controlled program depending on its output.
For some reasons it might be useful to disable autoloading, do some stuff and enable it again later. When using some frameworks or libraries this should be done in an anonymous way. For that pupose PHP provides the following functions:
When it comes to deleting a directory tree most solutions that have been posted around are recursive functions, like the following: ... While this is easy to implement it has some disadvantages when it comes to large trees ...
Windows XP is pretty old, but however, you may know those friends which are using quiet ooooold laptops, having a system crash but don't want to purchase a new one. When those laptops don't have a working CD-ROM drive anymore and ...
Interesting question that is about to deleted on stackoverflow.
There are several pitfalls when using POSIX signal handling with php. The following example should help to get around them. The example forks a child process and afterwards sends the `SIGTERM` signal to the child. I'll guide you through the important sections:
Recently I was required to dump the source code of a closure in php, for debugging purposes. Here comes my first working approach:

Maximum URL Length

April 20th, 2013  Read more ...

I found an interesting article about the maximum length of an URL:

I recently found a GREAT point on floating point precision on stackoverflow. Here comes the link:

I was requested on stackoverflow to give a little download measurement script in PHP. Below the displayed page an info about download size and download speed should be displayed. I found the question really interesting. Here comes a short example how I would do this ...

The PEAR installer has no option to remove all packages from a channel at once. So I’ve crafted a small shell script for that task:


for pkg in $(pear list -c "$CHANNEL_NAME"  \
| awk '{if ( $2 ~ /([0-9]+)\.([0-9]+)\.([0-9]+)/ ) print $1}') ; do 
    pear uninstall "$CHANNEL_NAME/$pkg"

metashock PEAR channel

November 23rd, 2012  Read more ...

Using the PEAR channel server you can install / upgrade my php packages using the PEAR installer. The url is

During the development of my Linux From Scratch I were searching for a way to test the boot process using Virtual Box instead of rebooting my development computer again and again. I found some articles on how to achive this using Windows, but I use Linux on my computer. Finally I did it :) using VBoxManage internalcommands. As I found no articles on this, here comes a short howto:
Sometimes it is nessesary to copy a Linux binary with its lib dependencies to a folder or archive. For example when creating an chroot emvironment, create an initramfs or copy a binary from one machine to another with the same architecture and kernel interface (this is hacky, yes) Because I frequently needed to do this, I wrote a small shellscript for that purpose. Here comes the shellscript, explanation will follow ...

Wikileaks @ xkcd

Oktober 10th, 2011  Read more ...

Hehe … :)

A simple script that shows how to validate xml against in xsd schemas using PHP.