Thesis... 2 down, 1 to go!
Yay! Today I had my thesis presentation. It went pretty well
too. Now the
only thing missing is the Thesis to be finished itself. That is,
I am back to work.
Blazingly fast JS with Firefox on amd64?!
So, Firefox got some nice
JITted JS engine tweaks with 3.6 (still
rc, but who cares anyway?) - I was pretty excited at the time because of
that. JS just plainly sucks when slow... Well, the excitement didn't last
that long - no JIT-JS with a 64bit compiled Firefox 3.6...
The thing is, it's still pretty new stuff and the amd64 backend wasn't ready/
done/stable enough - the details are on the mozilla site anyway. But there's
light at the end of the tunnel! There is working amd64 support in tracemonkey that
is shipped with Firefox > 3.6 :). So for some days I am building firefox
from it's mercurial repo (A geeky friend of mine likes to call it Reh-Po...)
- runs smooth and pretty stable so far and it is fast!
Thesis... 1 down, 2 to go!
Today I had my oral examination, and it ended winsome! :)
Fixed AWK sudoku solver
Long time, the AWK sudoku solver was buggy and did not run properly - it
ran however, producing bad output. One kind reader brought it to my
attention that something was seriously (if that's the right word for
a back-tracking sudoku solver in AWK ;)) with that code. Well, my bad;
obviously I found it nice uploading a broken version - whereas on my
hard-disk the fixed code was silently getting older ;).
So, now I uploaded the proper
version.
Traycer2: Major code cleanup
Traycer2 was kind of not that active over the last months, until I
got over myself to fix some grave bugs and cleanup the whole code base
of unnecessary and ugly code...
![img[traycer/reorg.png]](traycer/reorg_th.jpg)
diffstat of an odyssey
long lives the mighty netcat!
Long lives the mighty netcat
for port in 21 22 23 80 110; do
nc $mysterious_options $myhost $port && echo $port
done
Still shorter mini sudoku
Some time
ago I played with python and
sudoku, one outcome was that rather short solver. I actually shrunk that one
to tiny 309 bytes, it's still more ugly and for this website i had to add some
more bytes ;)
309 bytes sudoku solver
def S(p,i=0,r=reduce,R=range,A=lambda a,b:a and b):
while p[i]:
i+=1
if i==81:print''.join(map(str,p));return
for s in R(1,10):
if r(A,[A(p[i/9*9+x]^s,p[x*9+i%9]^s)for x in R(9)])and\
r(A,[p[x*9+y]^s for x in R(i/27*3,i/27*3+3)for y in\
R(i%9/3*3,i%9/3*3+3)]):p[i]=s;S(p);p[i]=0
S(map(int,raw_input()))
This one, as the one before it accepts a 81 character line consisting
of characters [0-9] representing a puzzle.
Graphing an iptables firewall
Recently I found this
page on how an iptables
firewall could be visualized using the
graphviz package.
I did this thing on my own too, it is kind of different in it's
details, and I found it pretty interesting to analyze simpler
firewalls (just
seeing the structure is pretty
insightful).
Click to my page on
code
to see some examples and download the source.
Newer schniff and some sudoku solvers
I added a better
schniff
and two depth-first-search sudoku solvers to
code/.
There's not much to say about it ;). Check out the code page for links to sources.
fighting spam with spamassassin and crm114
For several years, I am using an exim -> procmail -> spamassassin setup
to limit that flooding of mails - it does work somehow, but lastly there are lots
of messages going through spamassassin - building 'custom' filters does not make
much sense so I search for an extra filter.
The solution,
crm114 works like a charm.
It's just 3 days that it is running and learning (well, I force it to learn ;) but right now
there was not even one lonely false-negative result (well, some false positives, but i need
to train it some more ;).
So, here is a huge thanks to the guys that made the pretty mailfilter.crm :)
T H A N K Y O U !
python gone bad...
It's again late in the night, and I discovered an astonishing fact
about short code; It does not make sense, to use proper formatting
or even descriptive variable/function/you-call-it names when working
on some useless but satisfying piece of code...
Long story short, I discovered for myself how to solve
sudoku
by not solving it ;)
brute force stripped down to 334 bytes
def S(p,i=0):
def A(a,b):return a and b
while p[i]:
i+=1
if i==81:print''.join(map(str,p));return
for s in range(1,10):
if reduce(A,[A(p[i/9*9+x]^s,p[x*9+i%9]^s)for x in range(9)])\
and reduce(A,[p[x*9+y]^s for x in range(i/27*3,i/27*3+3)\
for y in range(i%9/3*3,i%9/3*3+3)]):p[i]=s;S(p);p[i]=0
S(map(int,raw_input()))
running it
$ cat puzzle
006000008900100607030200109140000000705610000003900000600004830020030060000809000
$ python sudoku.py < puzzle
216497358984153627537286149142378596795612483863945712679524831428731965351869274
$
Well, there are definitely nicer way to do this (that's just a nice opportunity
to get to know
Knuth's Algorithm X...
but, time will tell). So, this code is for people that know how to read it ;) so don't bother mailing
me how ugly and incomprehensible it is ;)
update This thing actually stripped down to 309 bytes by not obfuscating too much code
but there is a really _long_ line (to save some spaces ;) wich would not look nice inside my codebox.
If anyone is interested, let me know (see
about/ for email).
strange attractors
Once again I started playing some time with strange attractors.
This time i wrote an attractor finder app (500 LoC isn't really an app....),
It does pretty well, although it's slow if one likes to find 'beautiful'
attractors. I published a gallery of some 1xx attractors on my university
website, take a
look (including source code ;)).
about code and the maths
Ever tried getting complex formulas out of your favourite computer algebra system?
Well, i am an occasional
maxima user, and
recently I had to do some math and code... The short story is just below:
maxima session to define a function and it's derivative
(%i1) f(x, z) := cos (sqrt (x^2 + z^2));
2 2
(%o1) f(x, z) := cos(sqrt(x + z ))
(%i2) diff (f (x, z), x);
2 2
x sin(sqrt(z + x ))
(%o2) - --------------------
2 2
sqrt(z + x )
(%i3) diff (f (x, z), z);
2 2
z sin(sqrt(z + x ))
(%o3) - --------------------
2 2
sqrt(z + x )
(%i4) string (subst (pow, "^", diff (f (x, z), x)));
(%o4) -x*pow(pow(z,2)+pow(x,2),-1/2)*sin(pow(pow(z,2)+pow(x,2),1/2))
(%i5) string (subst (pow, "^", diff (f (x, z), z)));
(%o5) -z*pow(pow(z,2)+pow(x,2),-1/2)*sin(pow(pow(z,2)+pow(x,2),1/2))
Short explanation The string function does convert an expression to
a maxima-parseable string, i.e. not c-code, so we need to substitute those ^2 with
some more c-like stuff like pow (which are too expensive here, be cool, that's just
an example ;). As you see, the resulting string is valid c or - with some cosmetic
changes - even
J<censored content>a.
Now, we need not even to use subst, as we can apply some
vim or
other
magic to get those ^2 etc. away :).
git and graphviz's dot
I discovered one cool thing about git's all-mighty-tools and
the
graphviz
package which brings us the tool dot...:
create a graph of revisions, quick and dirty
(echo -e "graph git {\nsplines=true"; git rev-list --parents --all| \
sed -e 's/^/"/;s/ /" -- "/g;s/$/"/'; echo "}") > graph.dot
dot -Tsvg graph.dot > graph.svg
$myFavouriteImageViewer graph.svg
Yes, it really is ugly and barebones - but also just
what I discovered some minutes ago :)
And before I forget about it: a big thanks to the graphviz guys!
NetBSD server set up
Given the fact that my current linux server is about to die
I decided to work on a new one, this time trying to do it with
netbsd. To see the current status ans eventual updates, see
my netbsd page.
I also added a simple tool I've redone during a course that was
way not-so-interesting...
tr.c
dumb xml parser
It's been some hours that I was thinking about coding a
small and dumb
XML parser. Very limited in terms of XML, but
see my
page on code...
newer and better schniff!
It is more than a month that I implemented select(2) in schniff... but i just
forgot to put it here. well
look for yourself :)
I just found another snippet - it's a purely STL-strtok. It makes heavy (well
some lines of code... heavy is just a percentage) use of stl functors and such stuff.
Take a look if you like.
venom, an arp poisoning tool - and backup.sh
Currently I am attending a network programming course. The assignment for
next month is a small arp poisoning tool base upon
libnet 1.1. It's
kind of early for the code to be finished, fun I had fun doing it, and
learned to appreciate libnet ;). So find it on my
code page.
Additionally I published the backup script that is currently running on
my server - it is running for about - hmm 2 to 3 weeks now ;). see
the code section
revamped site using XML and XSLT
few days ago I started looking at
XSLT and
XPath...
One of my first thoughts was how cool it might be to use xml to store content
and just transform it to html/xhtml when publishing. This offers a great much
of flexibility.
I can now use those nice small link-icons, signalling whether
a link is internal, external or an email. And, the most significant part why
I switched away from the html-hell is a self-made xml
doctype, an easy way to integrate
menu and the near 100% decoupling of
content and layout. Well, I am relatively
new to xsl and there is much space for improvements ;) - feel free to
contact
me about any ideas/critics or questions.
And btw. did anybody ever tried a tea of cherry and chilli?!
register machine
I was just learning some theory and there was a nice example of a simple
register machine in the book that could do some mathematical operations
on integers. I coded a small tool that does axactly that and it is quite
nice running. See for yourself:
cd code/.
simplistic/dead-simple/stupid/your-words-here packet sniffer
Some weeks ago I wrote one of those brain-dead small tools... see the code
and a short introductory note in the code section.
cd code/.
link to my ray tracer log
I added a link to another server, holding the progress I make with my
ray tracer. It's currently bit out of date - there are exams approaching ;)
Just take a look, the are quite interesting images - and for a ray tracing
coder interesting facts (maybe) - well, see yourself. And just in case
you missed that
link.
some changes
Time passed - and not to slow.... there was a lot of stuff happening, I made
a one semester vacation to earn some money at Hoffmann-La Roche AG in Basel
as an Administrator for SAP and IXOS.... I've learned quite a lot of things
by the way ;). But I'll leave the firm this week... maybe I'll return in
the future - but, I have no idea :)
I too did some code stuff in the meantime. First there is the biggest
and messiest project I aver started... a small ray tracing application
_without_ any file input and very restricted feature set :) - but it does
kind of nice images when used right - and I'd really like to continue work on it
or maybe - redo a great part of it... well, time will tell I think. For
further information on this - click
traycer
on the left-side menu ;)
redesign
OK, after a year now, I decided to redesign my home page. This time I did not
all this on my own - I copied some parts of css/xhtml from
ESR's home page... I found it very pleasent to read
and hey... it isn't ugly :). I do read all those
HTML advices on ESR's website
- all I can say about them is: he's right! never do things like that or you
will be punished!
Some words on the new website - I do cancelled some parts out of the
website like a page per programming-language which does not made much sense (in the
end it's all just ugly code ;o)).
Next I want to let you see some of my dotfiles, i.e. configurations for various
programs like bash, vim or screen.
Ah, you noticed those freaky buttons? Well, I decided to let the world know how
this page is made up, what tools I used and what standards it is conforming to.
added some perl code....
I hacked up some
perl code
to parse ip addresses of the form 10.0/16 or 192.168/24.
It
is ugly but it works really nice for me :). OK, it is not complete, it's
just the code without any usable program arround it - maybe someone can use it?
c sockets for c++
I made up a small class
wrapper for inet sockets for c++. Basically it puts the main
things inside the class and translates signals/errors to exceptions - and... it can throw
a
lot exception - since there can be errors... It seems to work and realizing
a small tcp-connect scanner from it is really simple :)
assembler code and something weired.sh :)
Some time ago I coded this small
weired.sh
script. It takes one or two input parameters
and then prints successive lines based on that input (or default if not given ;o))
The output of this script looks like the following:
1
11
21
1211
111221
and so on ;o). Well, i did a perl
version of this thing, it is somewhat uglyer (my english
... well, don't talk about it):
$x=($ARGV[1]or 1);print"$x\n";map{@d=split//,$x;($x,
$u,$w)=("",0,$d[0]);map{$w==$_ or$x.="$u$w",$u=0;++$
u;$w=$_}@d;$x.="$u$w";print"$x\n"}1..($ARGV[0]or 9);
assembler code: rsa and mini cat
In february of 2005 I made myself familiar with the RSA encryption algorithm as an
exam preparation. I did RSA implementations in
python,
c
(with libgmp) and
assembler
(only for really small numbers, i.e. 32bit integer). The best of them is the one I
did in c using the LibGMP for arbitrary precision maths (which also does tests
for primarility which isn't that easy for
big primes.
The second one is a cat in assembler... I used mmap to access files and read for
stdin reading. I did not limited the maximum size of mmap chunks so there might be
some problems - for small test files it worked though ;)
here the source
python code: cheapdial and strange.py
This time I uploaded
cheapdial. A tool for selecting the cheapest internet-by-call
provider based on a set of provider-configs. The documentation is not that good, but
the config format is not complicated.
Next I wrote a simple OpenGL visualization for strange attractors - in python too ;)
I tried to use OpenGL display lists wherever possible to get maximum speed in displaying,
I think it worked ;). Tips on how to use are included in the source.
strange.py