Was: Zeugs. Thema: Alles mögliche.
Uncategorized
Produkte gratis testen mit trnd
Jun 3rd
Bisher 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
Apr 16th
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:
1 2 3 | #!/bin/bash -e # or set -e |
By either Modifying the Shebang or by using the set 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:
1 2 3 4 5 6 | command_that_may_fail || true # or set +e command_that_may_fail1 command_that_may_fail2 set -e |
Activate X-Ray (debug) Mode
1 | [ -n "$DEBUG" ] && set -x |
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:
1 2 3 4 5 6 7 | #!/bin/bash -e [ -n "$DEBUG" ] && set -x w1="Hello" w2='World' echo "${w1} `echo $w2 | sed 's/World/Universe/'`!" |
And this is what we get:
1 2 3 4 5 6 7 | dratir@ajax:~$ DEBUG=1 ./test.sh + w1=Hello + w2=World ++ echo World ++ sed s/World/Universe/ + echo 'Hello Universe!' Hello Universe! |
Get the absolute Path to the Script
This is basically an easy one, you just have to know it:
1 2 | script="`readlink -f $0`" wdir=`dirname "$script"` |
However, if you use pwd 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:
1 2 3 4 | for cmd in command1 install useradd groupadd command2 do test -x "`which $cmd`" done |
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:
1 2 3 4 5 6 7 | 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 } |
Wil 50m
Jan 17th
sprainTV – Doch kei Chabis
Jan 14th
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:
!!
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:
The Making of Chrome Features
Dec 17th
Die meisten von euch kenne wahrscheinlich Google’s Werbespots fuer Google Chrome (Falls nicht: Hier anschauen. Los!)
Nun hat Google ein Video veroeffentlicht, welches die Entstehung dieses Clips zeigt.
Wirklich sehr interessant zu sehen, wie die Jungs und Maedels da zu werke gehen!
Video nach dem Klick. More >
Mercedes Benz Mixed Tape 28 – jetzt online!
Sep 15th
Soeben per Newsletter reingeflattert:
Folge 28 der Mercedes Benz’schen Gratis-Musikcompilation “Mixed Tape” ist ab sofort unter www.mercedes-benz.tv/mixedtape erhältlich.
Gut hör!
Mirror’s Edge: Mal wieder ein Top-Abspann
Sep 9th
Hab das wochenende mein Mirror’s Edge zurückgekriegt, und musste es natürlich gleich (endlich) mal durchspielen!
Als nach ein paar Stunden (die Story ist nicht soooo lange) der wohlverdiente Abspann über den Bildschirm rollte, fiel mir die geniale Melodie im Hintergrund auf. Meiner Meinung nach passt die Melodie einfach perfekt zur stimmigen Atmosphäre von Mirror’s Edge.
Alex Andreev – Hermetic Art
Sep 4th
“Hermetic Art” Nennt der Russe Alex Andreev seine Werke.
Was er damit genau meint, weiss ich auch nicht so genau ^^. Beachtenswert sind seine Werke auf jeden Fall!
Bei English Russia » Hermetic Art gibts eine schöne Auswahl seiner Werke. Wer mehr will, schaut am besten in Alex’ Blog!
PHP ‘and’
Aug 3rd
Wieder was gelernt:
<?php $foo = true; $bar = false; $foo and print 'fuuuu'; $bar and print 'baaar'; ?>
Ergibt “fuuuu”!
Klappt zwar mit print, nicht jedoch mit echo!



Gequatsche