#### UPDATE #####
To have a look at the project:
click me
###############
hi guys,
I decided to register an account on github to share some of my coding projects with the world. By now I only uploaded huntersim so far but some others will follow soon. If you want to help me by commenting or patching it, feel free to do so. Get an account at github.com and tell me you account name by mail. I could then add you to the collaborators and you can submit your changes directly. If you just want to take a look or run the program you can of course just clone the repository without registration.
The public clone URL is: git://github.com/ap0calypse/huntersim.git
You can clone the repository with the following command:
git clone git://github.com/ap0calypse/huntersim.git
So, if you want to contribute to the project (or fork it, whatever) tell me your username and I add you to the collaborators. You should have some git knowledge. But don’t be scared. You can’t destroy anything
hi guys,
some days ago I decided to write a little simulation in Perl. Well, … here is the result (huntersim-0.1). The package contains a README where everything should be explained.
Have FUN!
UPDATE:
Because people want to see pics:

UPDATE:
##############
I now rewrote the script a little bit to use a private MAC-area because of problems when generating some MAC-addresses. Please use this version if you want to use it …
##############
hi guys,
yesterday I told you how to change your MAC address. Because I’m unbelievably lazy I decided to write a little helper-script to do this automatically. This script generates a random MAC address and brings the interface up with it.
here it is: change-mac
#!/usr/bin/perl
use strict;
# name: change-mac
# author: ap0calypse (ap0calypse@agitatio.org)
# purpose: helper script for bringing an interface down
# and up again with a random MAC-address
# date: 2009-04-15
# replace this with your wlan-interface
my $interface = "wlan0";
my @val_mac = (0 .. 9, "A" .. "F");
my $rand_mac = "AC:DE:48:";
for (1 .. 6) {
$rand_mac .= $val_mac[rand(@val_mac)];
if ( ($_ % 2 == 0) && $_ != 6) {
$rand_mac .= ":";
}
}
system("ifconfig $interface down");
system("ifconfig $interface hw ether $rand_mac");
system("ifconfig $interface up");
good morning 
As I wrote in my last article I wrote a small programm to display a 5×9 matrix of letters like the commandline tool banner does. Of course, my version isn’t that powerful, but it works. my_banner doesn’t do line-breaks, so if the sentence is too long you’ll see simply nothing very useful
.
Here an example:
echo "ABCDEFGHIJKL" | perl my_banner
### #### #### ### ##### ##### #### # # ### ### # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # #### # # # ### ### # ##### # # ## #
##### # # # # # # # # ## # # # # # # #
# # # # # # # # # # # # # # # # # # #
# # #### #### ### ##### # #### # # ### # # # #####
and another one:
echo 'This is a test' | perl my_banner
##### # # #
# # # # ### ###
# #### #### #### #### # ### #### #
# # # ## # ## # # # # # # # #
# # # # ### # ### # # # ##### ### #
# # # # # # # # # # # # #
# # # # #### # #### #### ## #### #### ##
Here is the source: my_banner
You may ask yourself how it works? Well, I did it this way:
I figured out, that an ‘A’ for example would look like this in a 5×9 matrix:
### 01110 = 14
# # 10001 = 17
# # 10001 = 17
# # 10001 = 17
##### 11111 = 31
# # 10001 = 17
# # 10001 = 17
Well after I figured this out, I created an array inside of a hash for every letter from a-z A-Z and some special characters.
my %led_letters = (
'A' => [qw( 14 17 17 17 31 17 17 0 0 )],
....
'g' => [qw( 0 0 15 17 17 17 15 1 30 )],
....
);
The rest was easy after that. Maybe someone wants to expand it. Enjoy!
I’m currently thinking about writing my own blog-software. Yes, I know that there are hundreds of projects out there and some of them (like wordpress, which I currently use) are really good and have huge communities. But that’s not the point.
The reason why I’d like to do that is that wordpress is too feature-rich, too bloated for me. I don’t need 90 % of the functions it has to offer. All I want and need is a simple listing of stuff I’m currently thinking about or working at. Of course, there should be a nice interface for me to insert new articles, but I actually don’t need the ‘comment’-function. If someone wants to tell me something, he could drop me a line via e-mail too …
So, that’s why I’m thinking about creating my own blogware. It would be a nice exercise anyway. If I really complete this project I guess I’ll publish it under an open source license for anyone who wants to use or modify it for his/her needs.
Well, I tried my best for another challenge from codegolf.com.
I can’t imagine how these guys can solve this in less than 50 characters. I managed to solve it in 132 characters in Perl. Maybe I could try to solve it in Ruby too … later
Here is my approach:
@{$$a[$_]}=split/ /,<>;for 0..9;for(0..9){$A=$B=0;for$y(0..9){$A+=$$a[$_][$y];
$B+=$$a[$y][$_];}$Z=$A if$A>$Z;$Z=$B if$B>$Z;}print$Z;
Maybe someone else wants to give it a try. The task is to calculate the highest sum from a given 10 x 10 grid. Have fun!
Posted by ap0calypse on 10. September 2008 – 09:36
… of code quality:

I laughed very, very loud
Yesterday I discovered a funny challenge on a board I visit regularly. The challenge was to create the shortest possible program to get a given output. In my case, it was the “99 bottles of beer” song. Here is my solution:
$b=" on the wall.";for(reverse 1..99)
{$i=$_>1?" bottles of beer":" bottle of beer";
print"$_$i$b $_$i.\n";print"Take one down and pass it around,
",$_-1,"$i$b\n\n"if$_>1;}
print"Go to the store and buy some more, 99 bottles of beer$b\n";
236 characters (you can delete the newlines. I just put them in to make it more readable). So far I couldn’t get it any shorter. Maybe someone else could give it a try.
Ok, just did a short update. Now it has 235 characters:
$b=" on the wall.";for(reverse 1..99){print$_,$i=$_>1?
" bottles of beer":" bottle of beer",
"$b $_$i.\n";print"Take one down and pass it around, ",
$_-1,"$i$b\n\n"if$_>1;}
print"Go to the store and buy some more, 99 bottles of beer$b\n";
FINAL UPDATE:
#####################
I just discovered a small singular/plural problem with the code above, so I had to redesign it a little … This is now the final (and working) code:
$i=" bottles of beer";$b=" on the wall";for(reverse 1..99)
{$j=$i if$_>1;print"$_$j$b, $_$j.\n";$j=~s/es/e/ if$_==2;
print"Take one down and pass it around, ",$_-1,"$j$b.\n
\n"if$_>1;}
print"Go to the store and buy some more, 99$i$b.\n";
234 characters …
Filed under coding, linux, perl
[UPDATE]:
The new version is 0.2 and supports decryption. Have fun!
Hi guys,
after creating transpos-cipher and shift-cipher I thought of a way to really encrypt sentences in a reasonable way. I don’t have the knowledge to create an advanced Public-Private-Key system but I think I now created a simple but quite safe way to crypt symmetrically.
Here is the script: shift-cipher-ng
shift-cipher-ng works with STDIN like the predecessors, but uses a lowercase string as key to crypt the sentence. For example:
ap0calypse@shu:/tmp> echo "my very difficult sentence" | \
./shift-cipher-ng -k complicatedkey
[om kpza wmipmawzf dmptxrfo]
ap0calypse@shu:/tmp> echo "om kpza wmipmawzf dmptxrfo" | \
./shift-cipher-ng -d complicatedkey
[my very difficult sentence]
Well, now to the internals:
In the first step, we split the input-sentence to get an array:
[m][y][ ][v][e][r][y][ ][d][i][f][f][i][c][u][l][t][ ][s][e][n][t][e][n][c][e]
Now, we take the key and generate an array of the same length with the replicated key:
[c][o][m][p][l][i][c][a][t][e][d][k][e][y][c][o][m][p][l][i][c][a][t][e][d][k]
In the next step, we take the arrays index-by-index. The corresponding key tells the program, where the alphabet starts. So the resulting array looks like this:
[o][m][ ][k][p][z][a][ ][w][m][i][p][m][a][w][f][z][ ][d][m][p][t][x][r][f][o]
For more information start the program with the “-h”-parameter. Enjoy!
I just started writing my first poem in Perl ever. It isn’t as beautiful and clever as many others, but I’m a bit proud of it, mainly because it is my first one
. It seems a bit rude and brutal but it wasn’t intended to be in the beginning … it just happened
. Here it is:
#!/usr/bin/perl
$i = "am alone again ...";
for ($ever) {}
until ($i) {die}
@you = push @me, $away and split /my/, @heart;
while ("you are asleep") {
$i = chop ($YOUR, $FUCKING, $HEAD);
close($your_door) or ($this, $night) = ($your, last)
}
Works with Perl 5.8.8. Comments are welcome