o Hai!

Oh lord, I should probably blog “a bit” more frequently!
So I’ve decided to write regular blog posts on projects I’m working on…

… speaking of Project, this might proove interesting: A friend of mine talked my girlfriend into starting her own homepage. So this morning, i quickly bought her a domain and installed it on my webserver.

But now… how do you tell a non-geek how to run her own homepage? And I don’t want to run the Site for her either!

So I decided to abuse WordPress as a content management system. I find it quite easy to work with, and she can even edit her Homepage with her iPhone.

Time will show how ingenious my idea was… I’ll keep you posted! ;-)

PS: In case you didn’t notice; for the sake of my engrish skills and broader audience (especially on tech-related topics) I’ve decided to switch to english… God, I think I’ve lost half my english grammar since my time in Vancouver :S

Lehrer verteilt aus versehen Pornos

HOMOSASSA, Fla. — A Citrus County elementary student accidentally received a pornographic DVD from her teacher.

The sheriff’s office reports that the girl’s second-grade teacher had made 19 photo CDs for all the students in her class at Rock Crusher Elementary School. The CDs included pictures of the students throughout the year.

But when the 8-year-old girl went to play the disc Tuesday, adults on screen began to take their clothes off. A 12-year-old boy who was with the girl reportedly turned off the movie and told his mother.

Deputies found no pornography on the other 18 discs.

The teacher and her husband told investigators that the husband helped make the discs, and the adult DVD was his.

No criminal charges were anticipated, but the school was doing its own investigation.

Quelle: nwfdailynews.com

Warum zur Hölle ist uns sowas nie passiert? :D

Übersetzung: Eine 2. Klässlerin erhielt aus versehen eine DVD Pornos. Die Lehrerin hatte zuvor Fotos von ihren Schülern gemacht, und wollte diese nun als Foto-CD an die Kinder verteilen. Doch als die 8-Jährige die Disk zuhause abspielte, fand sie statdessen Videos von “Erwachsenen, die sich ausziehen” (Wie süss ^^). Der Ehemann der Lehrerin, welchem die DVD gehört, habe beim mithelfen offenbar die falsche Scheibe erwischt.

Produkte gratis testen mit trnd

trndBisher stand ich solchen Marktforschungsprogrammen eher skeptisch gegenueber. Thias’ Blogeintrag “Produkte gratis testen” auf eigent.li/ch hat mich dann aber doch neugierig gemacht. Hab mich darum jetzt auch mal registriert und mich gleich mal fuer das erste Projekt angemeldet.

Mal schaun was draus wird, ich halte euch auf dem laufenden! Falls ihr euch auch anmelden wollt, koennt ihr dies hier* tun.

*ja, das ist ein Referral Link und schreibt mir 3 “Wombats” (was auch immer das ist?) gut. Fuer euch aendert sich damit nix.

Bash Scripting Tips

Writing Shell (here: Bash) Scripts for productive systems can be a pain in the ass. Especially if you have varios flavors of linux in your environment.

I’d like to share some tricks I’ve learned in the past few weeks.

Make Bash fussy

This is something you REALLY wanna do:
[cc lang="bash"]#!/bin/bash -e
# or
set -e[/cc]
By either Modifying the Shebang or by using the [cci lang="bash"]set[/cci] command, you set Bash into “Fuzzy Mode”. This causes the script to exit whenever a command fails (and thus, the exit-code ist not 0/true).

You can disable this functionality for individual commands:
[cc lang="bash"]command_that_may_fail || true
# or
set +e
command_that_may_fail1
command_that_may_fail2
set -e[/cc]

Activate X-Ray (debug) Mode

[cc lang="bash"][ -n "$DEBUG" ] && set -x[/cc]
This turns -x on if DEBUG is set to a non-empty String and causes Bash to be VERY talkative.
Example. This is our Script:
[cc lang="bash"]#!/bin/bash -e
[ -n "$DEBUG" ] && set -x

w1=”Hello”
w2=’World’

echo “${w1} `echo $w2 | sed ‘s/World/Universe/’`!”[/cc]

And this is what we get:
[cc lang="bash"]dratir@ajax:~$ DEBUG=1 ./test.sh
+ w1=Hello
+ w2=World
++ echo World
++ sed s/World/Universe/
+ echo ‘Hello Universe!’
Hello Universe![/cc]

Get the absolute Path to the Script

This is basically an easy one, you just have to know it:
[cc lang="bash"]script=”`readlink -f $0`”
wdir=`dirname “$script”`[/cc]
However, if you use [cci lang="bash"]pwd[/cci] in your script prior to this call, it will fail

Check for needed commands

When working with many different installations, it’s a good idea to check if you’ve got everything you need in your Script:
[cc lang="bash"]for cmd in command1 install useradd groupadd command2
do
test -x “`which $cmd`”
done[/cc]
Because of -e (remember to set it), the script dies if a command can’t be found or executed.

Prevent infinite loops (and your Server from crashing)

Sometimes you need your script to restart itself. If you do it wrong [...] you may produce an infinite loop of self calling (which will cause your system to fail after the ~20’000st call, and thus, the ~60’000st open file).
So use this instead:
[cc lang="bash"]restart() {
pscount=`ps aux | grep $0 | wc -l` # count myself
[ $pscount -lt 10 ] || exit 1 # Exit if we are in a Loop
$script
# Don’t forget to fill $script with the absolute path to the script (see above)
exit 0 # to prevent the rest of the script to run
}[/cc]

sprainTV – Doch kei Chabis

Zugegegben, Anfangs war ich eher skeptisch, was sprainTV angeht. “Schowider sonen Chabis” war mein erster Gedanke.

Doch nachdem ichs nun in letzter Zeit regelmaessig geschaut hab, muss ich sagen: Gefällt mir!!!

Die Themen, die witzig praesentiert werden sind meist interessant, nicht selten geht es um etwas aus der Gegend ( = Schweiz). Zudem ist die Laenge ideal: Kurz und buendig!

Fazit: Als Schweizer (oder Schweizerdeutschversteher) definitiv einen Blick wert! Und drum: Hier, die aktuelle Folge 16 von sprainTV:

Continue reading