New logo for Iceweasel

Actually iceweasel is searching for a new logo.

When I updated a PC of our work group I recognized that iceweasel, iceape and icedove are searching for new logos. Micha just created one for iceweasel with xfig, here is a similar one with tikz:

\begin{tikzpicture}
\draw (-1,0) circle (1cm);
\draw (-1.2,0.3) circle (0.15cm);
\draw (-0.11,-0.4) -- (1,-1);
\draw (1,-1) -- (3,-1);
\draw (2,-1) -- (2.5,-2);
\draw (2,-1) -- (1.5,-2);
\draw (4,-1) -- (6,-1);
\draw (6,-1) -- (6.5,-2);
\draw (6,-1) -- (5.5,-2);
\draw (6,-1) -- (8,0.5);
\draw (-1.9,-0.4) .. controls +(190:1.8cm) and +(180:1.2cm) .. (-2,0);
\draw (-0.7,0.95) .. controls +(90:0.2cm) and +(60:1.8cm) .. (-1.1, 1);
\draw (-1.5,0.85) .. controls +(60:1.6cm) and +(60:0.2cm) .. (-0.85, 1.4);
\draw (3.5,-3) -- (2.5,1);
\draw (3.5,-3) -- (4.5,1);
\draw (3.5,2.5) circle (1cm);
\filldraw [white, draw=black] (2.8,1.7) circle (1cm);
\filldraw [white, draw=black] (4,1.5) circle (1cm);
\end{tikzpicture}

If the maintainer understand something about art they will use one of our creations! ;)

Tweet-button for website

Yeah, completely in twitter-fever! Just developed a tweet-button.

You can see the button at the end of every post. The button itself of course isn’t my work, I just copied it from twitter, but when you click the link around it you can tweet the actual post directly to twitter! Feel free to try it! ;)

It’s more than easy. All the code you need is (replace […]):

<a href="http://twitter.com/share?url=[URL_TO_THIS_SITE]&amp;lang=[en|de|..]&amp;via=[NAME_OF_YOUR_TWITTER_ACCOUNT_FOR_@_LINK]&amp;text=[TEXT_FOR_TWITTERMSG]" >
      Tweet it <img src="[TWITTER_IMAGE]"/>
</a>

So the code that I wrote in my theme is:

if ( is_singular() )
{
	$tweet = '<span id="tweetit"><a href="http://twitter.com/share?url=https%3A%2F%2F'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"].'&amp;lang=en&amp;via=binfalse&amp;text='.the_title('', '', false).'" >
	<span id="tweetittext">Tweet it</span>
	<img src="/wp-content/uploads/2010/08/btn_tweet_mini.png"/>
	</a></span>';
	$tweet .= "<br />";
}

After that just using the $tweet variable at any position I like ;)

Here you can find a documentation.

Journey to Usedom

The last two weeks I took a time out. The first week I visited my sister living on Usedom, Rumpel came with me.

Those of you who are following me on Twitter may have noticed the one or other story, it was one of the best trips I made! Very funny and of course much too short ;)

We cycled a lot of km’s, climbed on trees, swum in the Baltic Sea, took sunbathes on the beach, went to Poland and so on. Detailed reports would blow up the framework of this website, but I’ll provide some pictures at Picasa, here is also a YouTube video from Poland.

And I’ve prepared a funny animated gif of an interesting evening ;)

So, if you ever have the chance to go to Usedom: Do it!!

Usedom - Aug 2010
Usedom - Aug 2010

Entering next level: Wordpress 3.0.1

The yellow bar on the top of the administration panel was very annoying, so I just decided to update the Software.

Nothing special happened, please tell me if anything seems to be wrong!

Btw. I installed another plugin that tweets news from this blog. Let’s see if it works.

Expiration dates of hash functions!?

Just read the so called Algorithmencatalog (maybe Algorithms Catalog in English!?), published by our German Bundesnetzagentur. They seem to know exact expiration dates for hash functions ;)

In this PDF file I found the following table (see original screen-shot):

* i.e. for creation of qualified certs, not for creation or verification of other qualified signed data. ** i.e. for creation of qualified certs with at least 20 bit entropy in its serial number, not for creation or verification of other qualified signed data. *** exclusively for verification of qualified certs
Creation of qualified certs*: suitable til end of 2009 Creation of qualified certs**: suitable til end of 2010 suitable til end of 2010 suitable til end of 2015 suitable til end of 2016
SHA-1 SHA-1 RIPEMD-160 SHA-224 (SHA-1, RIPEMD-160)*** SHA-256, SHA-384, SHA-512

So I hope there is anybody out there that has started to crack SHA-1 to get finished this year :P

(maybe it’s the recounter’s turn!?^^)

Smart game

Yesterday, while waiting in a traffic jam, I implemented a small game. I read about this game in a book and to not get too annoyed about the waiting time I opened the lid of my laptop and wrote this game. This morning I completed it with some usual stuff to increase the usability..

It’s written in C++ and you can play against the CPU. There is a strategy that makes you win in almost every case! This game is a classic in game theory, but if I provide you with it’s original name it’ll too easy for you to solve the problem with help from Wikipedia or something like that. So just try it on you own ;)

The aim of the game is to clear all the stacks that are filled with o ‘s. The stacks may look like this:

stack   size
0:      ooooo (5)
1:      oooooo (6)
2:      ooooooo (7)
3:      ooooooo (7)
4:      oooo (4)
5:      oooooooo (8)
6:      oooooo (6)

Now it is your turn to choose one of these stacks and remove some or all o’s of it. Notice that you have to remove at least one of them and you can only remove o’s from one single stack! After your turn, the artificial intelligence will do the same. Afterwards it’s again your turn, until all stacks are cleared. Winner is the one who cleared the last stack, so try to get the last o ;) Here is the download.

You can choose the number of stacks and the maximum number of o’s a stack can carry:

USAGE:
        -n      number of stacks [2..30]
        -m      maximal stack size [5..50]

If anybody knows the strategy, feel free to tell me!

Download: C++: NIM - the game (Please take a look at the man-page. Browse bugs and feature requests.)

MTP and some workarounds

Actually I revived my Creative Zen and had some trouble with that crazy media stuff..

Ok, every body who knows me knows that I hate that media fuss, to many functions that nobody needs, and to many failures on important stuff. How to mount an MTP-fs I explained in a previous posting, here it is in a nutshell:

# install needed packages (had trouble with mtpfs v0.9, be sure you install < = v0.8)
$ sudo aptitude install mtpfs mtp-tools
# try to find the device
$ mtp-detect
libmtp version: 1.0.3

Listing raw device(s)
Device 0 (VID=041e and PID=4157) is a Creative ZEN.
   Found 1 device(s):
   Creative: ZEN (041e:4157) @ bus 1, dev 11
[...]
# mount the fs
$ mtpfs /mnt/mtp-dev
# after doing crazy work, umounting:
$ fusermount -u /mnt/mtp-dev

With mtpfs version 0.9 and libmtp8 from sid I just experienced segfaults reported by dmesg, but the versions from squeeze just work fine. Of course it is interesting that I’m not able to overwrite existing files:

itsme@MiniMe /mnt % cp /tmp/chicago.mp3 zen/Music
cp: cannot create regular file `zen/Music/chicago.mp3': Function not implemented

Curious, but the workaround should be clear ;)

Last but not least I can show you how to play a YouTube video on this device. The easiest way is to install the Firefox extension downloadhelper, so you can download the song as a .flv file. The usual player don’t know what to do with .flv , and of course mine doesn’t, so convert it with mencoder. Here is an example:

# just grab the audio
$ mencoder Sport-ist-ihr-Hobby.flv -of rawaudio -oac mp3lame -ovc copy -o Sport-ist-ihr-Hobby.mp3
# keep the video and create an avi
$ mencoder Sport-ist-ihr-Hobby.flv -oac mp3lame -ovc lavc -o Sport-ist-ihr-Hobby.avi

The audio file doesn’t have meta data yet, so my Zen can’t find a name for it (don’t know why they didn’t implement a fallback to name it by it’s filename). To edit the meta tags you can use common tools like amarok or XMMS, I used easytag.

So you see, with a little work everything will be fine!

Google-alarm

Just found it on F.A.T., a Firefox plugin called google-alarm! Look at this tool and recognize how much information you expose by simple surfing.

To make it work on my Iceweasel 3.5.11 I had to change the em:minVersion in the install.rdf of the .xpi archive. It’s just for noticing, I don’t provide this changed version because you should not download such things from sites like mine ;)

You should also take a look at F.A.T., they often have smart projects!

Welcome to twitter

When I signed in this morning Micha greets me with his status of eliminating the first pot of coffee. Very interesting… So we decided to start twittering ;)

This version is deprecated since twitter disabled Basic Authentication. For a new version see Twitter disabled Basic Authentication

I already registered an account about ten months ago, just to see how it works, but now I’ll try to show some activity and tweet a lot of boring things..

First of all I developed a little script that tweets my messaged via curl:

#!/bin/bash

user=USER
msg=$*
if [ "${#msg}" -gt 140 ]
then
    echo "msg too long: ${#msg}"
    exit 1
fi

curl --basic -u $user -d status="$msg" https://twitter.com/statuses/update.xml >> /dev/null

Just call it with your message, it will ask for a passphrase to your account.. Just download it and use it like ./tweet.sh yeah it works .

And of course I’ve written a script that dumps all news to my console. To parse the XML I’m using Perl:

#!/usr/bin/perl -w
use warnings;
use strict;
use LWP::UserAgent;
use XML::TreeBuilder;
use XML::Entities;
use POSIX;
binmode STDOUT, ":utf8";

my $max = 10;
$max = $ARGV[0] if ($ARGV[0] && isdigit ($ARGV[0]));

my $browser = LWP::UserAgent->new;
$browser->credentials('twitter.com:443', 'Twitter API', 'USER' => 'PASSWORD' );
my $response = $browser->get('https://twitter.com/statuses/friends_timeline.xml');
die "failed...\\n" . $response->status_line if (!$response->is_success);
my $tree = XML::TreeBuilder->new();
$tree->parse($response->decoded_content);

my $anz = 1;
foreach my $status ($tree->find_by_tag_name ('status'))
{
	my $time = XML::Entities::decode ('all', $status->find_by_tag_name ('created_at')->as_text);
	my $text = XML::Entities::decode ('all', $status->find_by_tag_name ('text')->as_text);
	my $user = XML::Entities::decode ('all', $status->find_by_tag_name ('user')->find_by_tag_name ('screen_name')->as_text);
	print "$text\\n\\tby $user at $time\\n\\n";
	last if (++$anz > $max);
}

A little bit more code, but easy to use! Just download and run it with ./twitstat.pl [MAX_NUMBER_OF_TWEETS] . (You may need some additional Perl libs)

So let’s see how long I keep going on.. You can follow me at http://twitter.com/binfalse

Downloads: Bash: tweet.sh (tweet from command line) Perl: twitstat.pl (get latest news) (Please take a look at the man-page. Browse bugs and feature requests.)

Mensa plan

I often check what our canteen offer for lunch before we leave our building. The website that presents this portfolio is one of the worst I’ve ever seen and meanwhile I noticed that my private walking Mensa planer has still some bugs, so I had to think about an alternative solution and developed a little Perl script…

My initial idea was to read the website, parse the XML code and print the meals. Not a bit of it! The code of this site is nothing like valid! They invent new tags I’ve never heard about, they close nowhere opened paragraphs or table cells, I do not find the html-closing tag (the document ends with closing it’s body) and so on… It’s to much to mention all it’s unique features, but let me blame the producer: Peinhardt IT Systeme. Seems to be professionals… (A notice has left my mailbox, looking forward to their answer)

How ever, XML parsing fails, solving the bugs also fails, to much of it… So I’m now just grabbing the HTML-code, to extract the interesting content, with a more or less ugly regex, and print them to console… Here is the code:

#!/usr/bin/perl -w

use warnings;
use strict;
use LWP::UserAgent;

binmode STDOUT, ":utf8";

my $url = "http://meine-mensa.de/speiseplan_iframe";
my $mensa = 5;

my $browser = LWP::UserAgent->new(parse_head => 0);
$browser->timeout(10);

my $response = $browser->post ($url, ["selected_locations[]" => $mensa]);
my $content = $response->decoded_content ();
$content =~ s/\n//g;

while ($content =~ /<span style="font-weight: normal; font-size: 12px" class="counter_name">(.+?)<\/span>.+?<span.+?>(.+?)<\//gi)
{
	print $1.":\t".$2."\n";
}

So if somebody is also joining the Mensa Weinberg, you can copy this code or download it. The other canteens are also available, just change the value of the variable $mensa to your preferred one. The numbers can be found in the source code of this stupid website. Ok, to save you from trouble here are the numbers:

Cafeteria Brandbergweg
11
Cafeteria Burg
12
Mensa Bernburg
8
Mensa Dessau
13
Mensa Franckesche Stiftungen
14
Mensa Harz
3
Mensa Köthen
7
Mensa Neuwerk
9
Mensa Tulpe
10
Mensa Weinberg
5

Well, that’s it! Now you can decide within seconds whether it’s worthy to go to lunch or better stay hungry ;)

Download: Perl: essen.pl (Please take a look at the man-page. Browse bugs and feature requests.)