maZZoo
    home
    blog
    feed
    eyes
    info

code();


dietperl - perl-5.8.8 in 2 MB


A build of perl-5.8.8 statically linked with dietlibc results in a i386 binary of 4506412 bytes, upx'd down to 2021702 bytes. All default perl extensions are enabled.



rndpic


rndpic is a small CGI which chooses a random jpg image from a directory and delivers it to a http server. You can see it live in my "eyes" section. Reload to see another picture.

rndpic-0.1.tar.bz2



bluestep


/*
 * bluestep - locks your screen once you step out of the room,
 *            provided that you took your bluetooth enabled
 *            mobile phone with you.
 *
 * version 0.01
 *
 * usage: bluestep <bdaddr>
 *
 *      bdaddr  - MAC address of the remote bluetooth device
 *
 *
 * (c) 2005 by Matthias Wenzel, licensed under GPLv2
 *
 */

this tiny daemon peridically pings your bluetooth mobile, if doesn't get responses for a while it will lock your X desktop with "xscreensaver-command -lock".

hints:
figure out your <bdaddr> with:
# hciconfig hci0 up
# hcitool scan
Scanning ...
        00:11:22:33:44:55       my_left_foot
# 
try to ping your device (hciconfig/hcitool/l2ping come with your bluetooth libraries and tools):
# l2ping -c 3 00:11:22:33:44:55
Ping: 00:11:22:33:44:55 from 00:55:44:33:22:11 (data size 44) ...
0 bytes from 00:11:22:33:44:55 id 0 time 27.52ms
0 bytes from 00:11:22:33:44:55 id 1 time 32.05ms
0 bytes from 00:11:22:33:44:55 id 2 time 47.04ms
3 sent, 3 received, 0% loss
if the above command works you're probably set to run bluestep!

bluestep-0.01.tar.bz2



fbskate - bouncing jpegs on framebuffer devices


a quick and dirty hack to display jpegs on a framebuffer device. images larger or smaller than the framebuffer will bounce off the edges in good old pong style. this code does not do any errorchecking, all is "works for me" quality!

BUGS:
 I don't do propper /dev/fb0 handling, just enough to run on my 32 bit
 framebuffer devices. Virtual resolutions are probably unsupported.
 I don't do propper JPEG decoding. BW images and somewhat rare color
 mappings won't work.

fbskate-0.01.tar.bz2


Tendrils level viewer - a Perl/GTK2 tutorial




I was playing Tendrils. Too much of it - until I didn't get on in level 5. Actually level 5 was buggy on that release ;)
But I decided to continue the aventure in programming Perl/GTK2 and had my autodidactic tutorial in displaying the level maps. Having been there having done that, I consider GTK2 being very slow in Perl and Tendrils being a good reminder of my 8bit childhood.

showlevel-0.1.0.tar.bz2


mplscan


mplscan are my first steps in libdnet. read from the source:
/*
 * mplscan 0.1.0
 * sends out MPLS packets over IPv4/GRE
 * packet format: [ IPa [ GRE [ MPLS [ IPb [ UDP ]]]]]
 *
 * actually i didn't test whether machines answer to this type of
 * packets, but rumors have it they do. i wrote this to keep my
 * fingers warm and get into libdnet, and i added GRE and MPLS support.
 *
 * (c) 2005 by Matthias Wenzel, mazzoo /at/ mazzoo.de
 * mplscan.c is licensed under GPLv2
 * the two files gre.h and mpls.h are "AS IS" and may make it into libdnet
 *
 */
mplscan-0.1.0.tar.bz2


dynamics mobile IP SNMP extension


Within the research project IPonAir Sascha Janz and Timo Drick from the University of Frankfurt extended the dynamics mobile IP package with SNMP. You will need net-snmp to get it running.




oldcalendar.pl

in the listed years you can use old calendars from the years printed on the right:
$ ./oldcalendar.pl 2005 2020 100
2005 :  1994 1983 1977 1966 1955 1949 1938 1927 1921 1910
2006 :  1995 1989 1978 1967 1961 1950 1939 1933 1922 1911
2007 :  2001 1990 1979 1973 1962 1951 1945 1934 1923 1917 1906
2008 :  1980 1952 1924
2009 :  1998 1987 1981 1970 1959 1953 1942 1931 1925 1914
2010 :  1999 1993 1982 1971 1965 1954 1943 1937 1926 1915 1909
2011 :  1994 1983 1977 1966 1955 1949 1938 1927 1921 1910
2012 :  1984 1956 1928
2013 :  2002 1991 1985 1974 1963 1957 1946 1935 1929 1918 1907
2014 :  2003 1997 1986 1975 1969 1958 1947 1941 1930 1919 1913
2015 :  1998 1987 1981 1970 1959 1953 1942 1931 1925 1914
2016 :  1988 1960 1932
2017 :  1995 1989 1978 1967 1961 1950 1939 1933 1922 1911
2018 :  2001 1990 1979 1973 1962 1951 1945 1934 1923 1917 1906
2019 :  2002 1991 1985 1974 1963 1957 1946 1935 1929 1918 1907
2020 :  1992 1964 1936 1908
sourcecode:

#!/usr/bin/perl -w

# oldcalendar.pl [startyear] [endyear] [recentyears]
#
# prints out the years of old calenders you could use
# in startyear (def=2005) through endyear (def=2010)
# considering calenderyears [startyear-recentyears .. startyear-1]
#
# (c) 2005 Matthias Wenzel


use strict;

sub weekday($$$){
	my ($day, $month, $year) = @_;
	# see
	# http://www.tondering.dk/claus/cal/node3.html#SECTION00360000000000000000
	my $a = int( (14 - $month) / 12 );
	my $y = $year - $a;
	my $m = $month + 12 * $a - 2;
	my $d = ( $day + $y + int($y / 4) - int($y / 100) + int($y / 400) + 31 * int($m / 12) ) % 7;
	return $d;
}

my $start = 2005;
my $end   = 2010;
my $old   =   50; # dump $start - $old calenderyears

$start    = $ARGV[0] if $ARGV[0];
$end      = $ARGV[1] if $ARGV[1];
$old      = $ARGV[2] if $ARGV[2];

$end = $start if $start > $end;

my $curr=$start;
while ($curr <= $end){
	print $curr . " : ";
	my $o = $start - 1;
	while ($o ne ($start - $old)){
		if (( weekday(1,1,$curr) eq weekday(1,1,$o) ) & ( weekday(31,12,$curr) eq weekday(31,12,$o) )){
			print " " . $o;
		}
		$o--;
	}
	$curr++;
	print "\n";
}


crossgcc - ARM patch

Building crosscompilers was a pain in the ass. Up to gentoo's crossdev.sh script. Here's a patch for crossdev.sh for StrongARM CPUs - it should do for other ARMs either, just change the -mcpu and -mtune flags. It patches a tiny bug in glibc-2.3.2 and adds ARM support into crossdev.sh.

Actually the patch does one more thing: the original script copies (!) all source trees from /var/tmp/portage/[binutils|gcc|glibc|linux-headers] to /var/tmp/portage/crossdevbuild. The cp ist replaced by a mv (probably not the gentoo way, but saves me space on the HDD during build time).

The files are licensed under GPL v2.

o patch against crossdev 0.4-r1
o the standalone patched crossdev.sh-arm-move


das clock fake 77

'das clock fake 77' is a radio transmitter.



This program paints black and white stripes on your screen. Your monitor will now emit electromagnetic waves. Basically a carrier frequency of 77500 Hz. In Europe commonly used DCF77-radio-clocks will tune into that frequency and listen ... to be honest, only if they're close enough to your monitor they may/might. The screen image will be modulated to emit the 59 information bits plus the one sync bit per minute. Actually we only need to switch between two static images once per second, but with a high timing precision of about 50ms. Nothing evil will happen to your monitor or LCD, we're not playing with your modelines or the sync of your monitor. The program uses the SDL-library to acess the screen, this can be a problem when you don't have HW-acceleration - I had to switch back to 16bpp on my X to get the required 20fps. The program now tests wether the screen performance is sufficient to achieve the required 20 fps.

See the README for more details. Get it here.



ptrace() Kernel vulnerabilities

There have been several bugs in the linux kernel 2.2 and 2.4 ptrace() syscall. I keep being conservative, I use old kernels and protect them with the no_ptrace kernel module npt.c (download)