Linux: Change timezone on Debian/Ubuntu

Change timezone on your Ubuntu/Debian system by opening a Terminal and run this command:

sudo dpkg-reconfigure tzdata

Bash: Simple HDD/SSD speed test using dd

terminal-icon-100x100
I wrote a (very) short script to test hdd or ssd speed using dd. You can find the code here:

hdd-speed-test-1gb.sh
and as text:
hdd-speed-test-1gb.sh.txt

The script uses dd and /dev/zero for writing a 1GB sized tempfile. Then the tempfile is written by dd to /dev/null. dd produces some output where the transfer speed is mentioned. Afterwards the tempfile is removed.
It is really just a tiny script, so i do not have to remember the dd syntax every few months.

Facebook: Like Buttons uses wrong url

I use the digg-digg Wordpress Plugin on this blog and found a annoying error - the like button does not use the correct url. I found out why and how to correct it.

|Den ganzen Beitrag lesen...

Bash: Remove all .svn folders - Un-checkout from svn

If you want to send somebody parts of your svn repository, then you mostly do not want to give them your .svn folders with all the settings and base files inside.

I wrote a short command to remove all the .svn folders recursive from the current directory:

for dir in $(find . -name ".svn" -type d); do rm -rf "$dir"; done

find . -name ".svn" -type d
- Will list recursive all directorys named '.svn' in current directory.

for dir in $(...); do rm -rf "$dir"; done
- Will delete all items from the result of $().

If you do not want to type and remember that much, you can easily add this as a bash alias.
Open your .bashrc and add this line:

alias unsvn='for dir in $(find . -name ".svn" -type d); do rm -rf "$dir"; done'

The next time you start a bash, you have a new command "unsvn".

PHP: List of common pitfalls

I have seen a lot of PHP code, good and bad ones. Even some exploits for pretty common things that were just careless implemented.
In this post i want to share some of these pitfalls so you dont have to make them on your own.

|Den ganzen Beitrag lesen...

PHP: Benchmark Inkrement und Dekrement

Wir haben alle in der Schule das kleine EinMalEins gelernt, doch selbst bei den simpelsten Anweisungen in Programmiersprachen gibt es noch Wissenlücken über Verwendung und Laufzeitunterschiede.
Im nachfolgenden Post wird mittels Benchmark ermittelt welche Art die schnellste ist eine Variable in PHP5 um 1 zu erhöhen (inkerment) oder zu verringern (decrement).

|Den ganzen Beitrag lesen...

PHP: Everything you need to know about secure password hashing

On each site you need to register, your password has to be saved. This is typically done in a database. There are several ways to do this and some of them are good practice, other a very bad idea.

|Den ganzen Beitrag lesen...

Bash: Rename all files inside current directory

Renaming all files inside a directory can be done with the following code.

find * -type f | while read FILE; do mv "$FILE" old_"$FILE"; done;

The code will take all filenames in the current directory, and append "old_" to the name.

find * -type f
- Will make a list of all files in the current directory.
while read FILE; do ...; done
- Will read from a list each line into the variable FILE.
mv "$FILE" old_"$FILE";
- Will rename the filename in the variable $FILE to old_$FILE. Check out the double quotes - they are important, otherwise filenames with spaces will break the move command.

Ubuntu: Booting with "quiet" and "splash" ist faster.

I like to see what is going on when my ubuntu boots, so i disabled "splash" and "quiet" in mit "/etc/default/grub" and updated grub via "update-grub" afterwards as root.
Today i checked how this might slow down the boot process, because of the much output by the kernel. This is my result:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" --> 28 Seconds
GRUB_CMDLINE_LINUX_DEFAULT="quiet" --> 32 Seconds
GRUB_CMDLINE_LINUX_DEFAULT="splash" --> 30 Seconds
GRUB_CMDLINE_LINUX_DEFAULT=" " --> 33 Seconds

On my system, "quiet" speeds up booting by 1 or 2 seconds, and "splash" by 2 or 3 seconds.

I might leave both on for faster booting, but i will miss my informative kernel output :(

Auto: Opel Corsa Scheibenwischer reparieren oder Batterie austauschen

Es war mitten im Winter, in Deutschland lag überall Schnee. Inzwischen sogar so viel dass ich keine Lust mehr hatte den Schnee von der Windschutzscheibe zu entfernen, das hab ich dann den Scheibenwischer machen lassen. Es ging so lange gut, bist der Schreibenwischermotor irgendwann unter ächzen den Geist aufgegeben hat, und meine Wischer schief und krum mitten auf der Windschutzscheibe meines Opel Corsa C standen.
Im folgenden Artikel beschreibe ich, wie man den Scheibenwischermotor demontiert, austauscht / repariert, und wieder einbaut.

|Den ganzen Beitrag lesen...