August 11, 2008 Archives

2008-08-11 02:15:35

new website online!

A few days ago, I stumbled across Volker Birk's blog. 'Cause I really liked the design, I decided to rebuild my own website using NanoBlogger.
Although I'm not completely satisfied with it yet, I think the result's already pretty considerable. :-)
BTW: The old site is still available here.


Posted by haui | Permanent Link | Categories: news

2008-08-11 01:27:50

palindromic numbers

Find all numbers from 1 to 999999, which are palindromic in base 2 and base 16.


Posted by haui | Permanent Link | Categories: linux

2008-08-11 01:24:17

Remove the last character from a string/variable (bash)

echo ${var:0:${#var}-1}
echo ${var%?}
echo $var | sed 's/.$//'

You could also use chop ;)


Posted by haui | Permanent Link | Categories: linux

2008-08-11 01:17:53

bash: list just directories


ls -d */ 
ls -l | grep ^d
find . -maxdepth 1 -type d
ls -F | grep /$
ls -1 | while read line; do if [ -d "$line" ]; then echo $line; fi; done
ls -1|while read l;do [ -d "$l" ]&&echo $l;done
perl -e 'foreach(glob(".* *")){print "$_\n" if (-d $_)}'
perl -e 'opendir(DIR,".");foreach(readdir(DIR)){print $_ ."\n" if(-d $_);}'
just kidding ;)
...


Posted by haui | Permanent Link | Categories: linux

2008-08-11 01:13:48

zig-zag scan in Perl


Posted by haui | Permanent Link | Categories: scripts, perl

2008-08-11 01:10:09

hint on 2-dimensional arrays in Perl:

$width = @{$array[0]};
$height = @array; 

Posted by haui | Permanent Link | Categories: perl

2008-08-11 01:08:35

rot13 "encryption" of a file:

tr A-Za-z N-ZA-Mn-za-m < file

Posted by haui | Permanent Link | Categories: linux

2008-08-11 01:01:42

Calculate the sum of digits of a given number

echo 1234 | sed 's/\(.\)/\1\+/g' | sed 's/.$//' | bc -l
perl -e 'print eval join "+", split //, 12345;' 

Posted by haui | Permanent Link | Categories: linux

2008-08-11 00:39:10

perl password generator

Another password generator, written in perl. As it's more advanced than the old bash script I recommend using this one, if you're to lazy to create a secure password by yourself. The special thing about this script is, that it's possible to specify the characters, that will occur in the password (e.g. it's possible to create a password, containing just the letters a, b and c (don't do this...))


Posted by haui | Permanent Link | Categories: scripts

2008-08-11 00:33:45

bash password generator

A simple shell script, that generates a random password from a given set of characters.


Posted by haui | Permanent Link | Categories: scripts

2008-08-11 00:30:09

Irssi - kick.pl

Ever wanted to kick multiple users with just one command? 

kick.pl makes it possible!

Usage:

/kck user1 user2 user3


Posted by haui | Permanent Link | Categories: irssi

2008-08-11 00:26:18

Irssi - wiki.pl

This script provides a fast way to "search" wikipedia from irssi.

Example:

/wiki rolling stones

prints http://de.wikipedia.org/wiki/Rolling_Stones in the current channel

and 

/ewiki rolling stones

expands to http://en.wikipedia.org/wiki/Rolling_Stones


Note: this script requires curl.

Posted by haui | Permanent Link | Categories: irssi