Thursday, July 26, 2018

Vacation in Gdansk - notes

We used the Wydmy fast train from Bohumín - get the tickets and couchette reservations well in advance, especially when you want to go during or near weekends. There are two types of coupes - three or two bedded. If the complimentary muffin is not visible, check the cabinet above the washbasin (hidden inside the table in the coupe). The morning herbata is free. The return train leaves too late in the evening (11 p.m.) and ours was 20 minutes delayed, next time consider going further to the north so we can leave earlier.

Current state of all polish beaches; also wsse.
Polish public transport lookup for android (buses+trains)
Public transport in Gdansk - buy enough tickets in advance, they are more expensive from the driver and some stations don't have vending machines.
Tramwaje wodne - F5 only makes sense to board at Żabi Kruk, it only has 50 places and is full immediately; it'd be a shame to miss. The port is the best. Latarnia is nice. Need to visit Westerplatte the next time.
Weather - Windy seems to be better, also contains waves prediction
Maps - with offline maps are unbeatable
Local sport events in Gdansk
Skimboarding - free on Wednesdays
Triathlon Gdansk
Pomorski Klub Orientacji, Harpus 
Rodzinne Gry Parkowe na Orientację
Malbork - when going by train, get off at Malbork Kałdowo. Forget the audioguide, the people guides rock. 4 hours might be enough. On the other hand there's reduced entry after 17:15.
Camp Stogi - crowded and the tent area is very hilly. Not really quiet before 10-11 p.m., but we've been to worse. Mosquitoes in the forest

Thursday, January 11, 2018

GPS coordinates of all Slovak villages

While I could get more or less complete GPS coordinates for Czech villages, I had little luck finding the same for Slovakia. In the end I downloaded OpenStreetMap data for Slovakia, cloned imposm.parser, and wrote a simple script to get comma separated values:

hajma@debian:~/bin/osm$ cat
from imposm.parser import OSMParser
import codecs
import locale
import sys

# simple class that handles the parsed OSM data.
class HighwayCounter(object):

    def coords_callback(tags, coords):
        for x in coords:
            if 'place' in x[1].keys():
                if x[1]['place'] == 'village':
                    if 'is_in' in x[1].keys():
                        print("\"%s, %s\", %s, %s" % (x[1]['name'], x[1]['is_in'], x[2][0], x[2][1]))
                        print("\"%s, Slovensko\", %s, %s" % (x[1]['name'], x[2][0], x[2][1]))
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
# instantiate counter and parser and start parsing
counter = HighwayCounter()
p = OSMParser(concurrency=1, nodes_callback=counter.coords_callback)


TRBP 2017, mission accomplished

I've joined the Trebic runners cup a bit late in the game, but I managed to get within the first ten in my category. Let's see how 2018 will be.

Monday, November 6, 2017

HROB 2017

My goals for this year's Mountain Orienteering Championship:
  • Don't get lost - check
  • Don't be the last one - check
  • Finish at worst as fifth from the end - check

Wednesday, November 1, 2017

Restoring Windows backup

A relative of mine asked me to restore a couple of files from backup CDs created by the windows native backup utility.
It turned out more difficult than I initially expected.

First, unlike other tools, the windows backup utility zips the files using the backslash as a directory separator and none of the Linux decompression tools can handle that.

Second, the files were encoded with one of the Windows native encodings, and none of the Linux decompression tools handle that (apparently unzip on Ubuntu is patched to add support for filename encodings, but Debian, as usual, is lacking).

What a mess ...

1. unzip with bsdtar as unzip would scramble the non-ascii filenames
$ bsdtar xf ../Backup\ files\
2. convert filenames to utf-8
$ convmv -r -f cp852 -t utf-8 --notest .
3. recreate the directory structure
$ cat
#! /usr/bin/env python

import os
import errno

# already created directories, walk works topdown, so a child dir
# never creates a directory if there is a parent dir with a file.
made_dirs = set()

for root, dir_names, file_names in os.walk('.'):
    for file_name in file_names:
        if '\\' not in file_name:
        alt_file_name = file_name.replace('\\', '/')
        if alt_file_name.startswith('/'):
            alt_file_name = alt_file_name[1:]  # cut of starting dir separator
        alt_dir_name, alt_base_name = alt_file_name.rsplit('/', 1)
        print('alt_dir', alt_dir_name)
        full_dir_name = os.path.join(root, alt_dir_name)
        if full_dir_name not in made_dirs:
            except OSError as exc:
                if exc.errno == errno.EEXIST and os.path.isdir(full_dir_name):
                    # the pass already exists and is a folder, let's just ignore it
        os.rename(os.path.join(root, file_name),
                  os.path.join(root, alt_file_name))

$ python

Friday, March 10, 2017

Turris becomes mine

Three years ago I was lent one of the test Turris routers, that later became Turris Omnia. As promised, I'm now able to buy the machine for a symbolic prize of 1 CZK (0.04 USD).

Thursday, January 26, 2017


It looks like my phone is one of the first few to receive regular LineageOS builds.