Michal Čihař - Blog Archives for Coding

Source code search

Have you ever need to lookup something in source code? Most developers probably did so. I needed to lookup something in Gammu sources and I decided to setup search engine over it. I decided to use Gonzui as it looks good and was easy to setup. So if you want to find something in sources, just point your browser to gonzui.cihar.com.

Later I added also other my code (phpMyAdmin, Wammu, python-gammu, polld), so you probably want to use advanced search to limit results.

How to get info about DNS server?

I never knew there are few special zones in DNS to grab infromation about DNS servers. Today while browsing PowerDNS recursor configuration, I noticed several config options defining replies on those special queries. So if you want to know which server is on the other side, you can try querying version.bind, version.pdns or id.server (CHAOS type, TXT class):

$ dig version.bind chaos txt

; <<>> DiG 9.3.2 <<>> version.bind chaos txt
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56291
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;version.bind.                  CH      TXT

;; ANSWER SECTION:
version.bind.           86400   CH      TXT     "PowerDNS Recursor 3.1.1 $Id: pdns_recursor.cc 838 2006-05-19 14:35:27Z ahu $"

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jun  2 15:30:06 2006
;; MSG SIZE  rcvd: 119

Time to update PGP keys

Time to time I do full update of local PGP keys from keyserver. This reduces need for updating keys when checking not so important signatures.

This time it looks like lot of signatures were added:

gpg: Total number processed: 1442
gpg:               imported: 1
gpg:              unchanged: 810
gpg:           new user IDs: 78
gpg:            new subkeys: 14
gpg:         new signatures: 31038

Updating of all keys should be done with gpg --refresh-keys. It attempts to receive keys from not respoding servers defined in some keys, so I wrote simple script to do the same using default key server:

gpg --list-keys | grep ^pub | grep -o '[0-9A-Z]\{8\}' | sort -u > /tmp/keys
< /tmp/keys xargs gpg --recv-keys

GnuPG path grabbing

Many times I needed "intelligent" way to grab key path from my key (and others I somehow trust for signing purposes) to other random key that gets to me.

Receiving keys for all signatures is quite expensive operation and you soon end with most of PGP keys on the world in your database. The best seems to fetch only needed keys. You can find path using PGP pathfinder & key statistics by Henk P. Penning. It's extremely useful site, where you can find many information about PGP keys.

So the logical step seems to be to write down script which will grab needed keys:

#!/bin/sh

if [ "$#" -lt 1 -o "$#" -gt 2 ] ; then
    echo usage `basename $0` ID [gpgparam]
    exit 1
fi

url=http://www.cs.uu.nl/people/henkp/henkp/pgp/pathfinder/mk_path.cgi

(
links -dump "$url?FROM=36E75604&TO=$1"
links -dump "$url?FROM=B3B2A12C&TO=$1"
links -dump "$url?FROM=65D0FD58&TO=$1"
) | grep -o '[0-9A-F]\{8\}'  | sort -u | xargs gpg --recv-keys --no-auto-check-trustdb $2

gpg --check-trustdb $2

And special bonus for Sylpheed-Claws users. Here is action to call above script:

ID=`gpg --verify %p /dev/null 2>&1 | \
grep "key ID" | tr -d "[:space:]" | \
tail -c8`;echo "==== Fetching $ID ===="; \
~/bin/gpg_get_path $ID --no-tty

Freehosting on pipni.cz

For some time, I've been using free vserver hosting on pipni.cz for phpMyAdmin demos. It had always so much troubles, so I decided to move that to my own server. As I don't want to drop it completely as it might be useful for some testing, I placed there mirrors of arch.cihar.com and dl.cihar.com under names arch2.cihar.com and dl2.cihar.com under hope that they will be available at least sometimes.

But I was wrong. Server doesn't autostart anymore and after starting it survives around 1 day, so it is not usable at all. I know it is free service, however I thought they offer it as advertisement for more expensive services they offer. I doubt this way will attract anybody…

I finally know what priority is

Looks like this week SourceForge finally showed me what priority and immediate words mean in their dictionary:

Subject: [ alexandria-Priority Support-1484474 ] Developer CVS down?
Date: Wed, 24 May 2006 12:34:12 -0700

Priority Support item #1484474, was opened at 2006-05-09 04:15
Message generated for change (Comment added) made by burley
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=629337&aid=1484474&group_id=1

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: Immediate Fix Needed
>Status: Closed

Okay, I just cancelled my subscription, it's simply not worth of provided services.

Paypal sucks

Hey Paypal is cool service. Sourceforge relies on it for their donation system as well as other service providers with payments. It (probably) works well if you live in US or other country which Paypal likes. If you live in one which they don't like, like Czechia, you have only chance to get limited account from them. Why the hell do they limit this. I can understand when I'd have to pay more for money withdraval as internation bank transfers are expensive, but why I can not receive money?

Trying to talk with their support and trying to get answer why it is not possible to receive money in country which is member of EU doesn't tell more than their website:

PayPal is constantly working to expand and improve services for our customers. We hope that we can enable you to use more of our award-winning services in the future.

It's great you're trying to improve services so hardly, that you were not able to allow me to receive money during two yers. Really good job.

PackTest lives

When I recently found one of forgotten old childs living in dark side of internet hidden under tons of advertisements, I decided to move it back to my server. This step doesn't mean revival of that testing, I just don't want to be connected with that site full of ads :-). So it doesn't really live.

Now I decided that it maybe deserves own domain. So if you want to see what I did more than six years ago, visit packtest.cihar.com.

NanoBlogger customisations

When I looked for blog system to use, I have looked to various systems. From big ones like Wordpress to small ones like NanoBlogger. At the end I ended with NanoBlogger, because it looked more suitable for my needs.

However I still needed some customizations to make it work exactly how I want. First was to enable experimental titpe-based links. This makes links look better and people (and search engines) can see from link what is the entry about. Besides uncommenting some parts of code commented with experimental title-based links, there was needed little change to archive generator to make correct links for previous/next entries.

Next think I wantes was RSS feed list for categories on main pages. This is needed as many people will be interested only in some parts of this blog. This part is a bit hacky and I choose simple way to do this by only changing parts in category links.

Last thing is listing which is included on other pages like pma.cihar.com. This part only uses existing code and doesn't really add anything new except two tempates for it.

Now I enjoy NanoBlogger and hopefully it will last some time :-). If you want to use same customization, patch is available here.