Archive

Author Archive

Spin-up the FTL-drive…

November 4th, 2011 2 comments

FTL…and jump.

Categories: cultural, fun Tags:

Trillian am 16.10. in Dresden @ Cafe Neustadt

October 13th, 2011 No comments

Die alten Fäden reißen nicht so schnell, deshalb wurde ich gebeten in meiner neuen Heimat Werbung für eine Band aus Halle zu machen, die ihr neues Album vorstellen. Am Sonntag ist deshalb Record Release Party im Café Neustadt. Eintritt ist frei, Beginn 20 Uhr.

trillian flyer

Categories: music Tags:

Pray for JAPAN from ThinkPad

March 31st, 2011 No comments
Categories: Uncategorized Tags:

On Conference Preparation Time…

February 7th, 2011 No comments
Categories: Uncategorized Tags:

Hacker Movie List

February 2nd, 2011 1 comment

http://www.comp.dit.ie/dgordon/Publications/HackerMovies/Dataset.htm

Categories: Uncategorized Tags:

DVB Reloaded: Verbindungsauskunft auf der Shell

October 12th, 2010 No comments

Der Post von Jupp hat mich inspiriert einen Schritt weiter zugehen. Da ich nicht weiß, zu welcher Haltestelle ich jetzt laufen muss um den nächsten Bus zu bekommen, ist doch eine Verbindungsauskunft viel wichtiger. Das ganze funktioniert erst einmal nur auf der shell, aber den Ausgabeteil sollte man leicht nach seinen Wünschen anpassen können.

Wer sich den Umstand des code kopieren sparen will fragt mich am besten nach dem file.

Hier mal ein Beispieloutput:

$ ./dvb-trips.py Helmholzstrasse Saxoniastrasse
Zeit der Abfrage: 22:17
ab 22:08 an 22:35 dauer 00:27 umsteigen 0
 > ab          Fußweg           Helmholtzstraße
 > ab 22:25    Stadtbus 63      Dresden Westendstraße
 > ab          Fußweg           Dresden Tharandter Straße
ab 22:19 an 22:48 dauer 00:29 umsteigen 1
 > ab          Fußweg           Helmholtzstraße
 > ab 22:31    Straßenbahn 3    Dresden Plauen Nöthnitzer Straße
 > ab 22:42    Straßenbahn 7    Dresden Hauptbahnhof
ab 22:31 an 22:53 dauer 00:22 umsteigen 1
 > ab          Fußweg           Helmholtzstraße
 > ab 22:39    Regionalbus 360  Dresden Mommsenstraße
 > ab 22:42    Stadtbus 61      Dresden Technische Universität (Fritz-Foerster-Platz)
 > ab          Fußweg           Dresden Tharandter Straße
ab 22:37 an 23:04 dauer 00:27 umsteigen 0
 > ab          Fußweg           Helmholtzstraße
 > ab 22:54    Stadtbus 63      Dresden Westendstraße
 > ab          Fußweg           Dresden Tharandter Straße
#! /usr/bin/env python
# coding=utf-8
 
import sys
import datetime
import time
import xml.dom.minidom
import urllib
 
def getTrips(dep_start, dep_target, dep_datetime):
    url_template = 'http://www.dvb.de/de/Fahrplan/Verbindungsauskunft/direkt.do?vaform[starttypeswitch_stop]=1&vaform[zieltypeswitch_stop]=1&vaform[startort]=Dresden&vaform[startname]=%s&vaform[zielort]=Dresden&vaform[zielname]=%s&vaform[zeittyp]=dep&vaform[datum]=%s&vaform[zeit]=%s'
 
    now_url = url_template % (dep_start, dep_target, dep_datetime[0], dep_datetime[1])
 
    string = urllib.urlopen(now_url).read().replace('=voe&uk_id=', '=voe&uk_id=')
    dom = xml.dom.minidom.parseString(string)
 
    def getText(nodelist, recurse=False):
        rc = []
        for node in nodelist:
            if node.nodeType == node.TEXT_NODE:
                rc.append(node.data)
            elif recurse:
                rc.append(getText(node.childNodes, recurse))
        return ''.join(rc)
 
    overview_table = None
    detail_from = None
 
    for h2 in dom.getElementsByTagName('h2'):
        text = getText(h2.childNodes)
        if text[:15] == 'Verbindungen - ' and ord(text[15]) == 220 and text[16:] == 'bersicht':
            overview_table = h2.nextSibling
            while overview_table.nodeType != overview_table.ELEMENT_NODE:
                overview_table = overview_table.nextSibling
            if overview_table.nodeName != 'table':
                overview_table = None
        elif text == 'Verbindungen - Detailansicht':
            detail_from = h2.nextSibling
            while detail_from.nodeType != detail_from.ELEMENT_NODE:
                detail_from = detail_from.nextSibling
            if detail_from.nodeName != 'form':
                detail_from = None
 
    if not overview_table or not detail_from:
        sys.exit(1)
 
    for tbody in overview_table.childNodes:
        if tbody.nodeType == tbody.ELEMENT_NODE and tbody.tagName == 'tbody':
            break
 
    trips = []
    for tr in tbody.childNodes:
        if tr.nodeType != tr.ELEMENT_NODE or tr.tagName != 'tr':
            continue
        tds = []
        for td in tr.childNodes:
            if td.nodeType != tr.ELEMENT_NODE or td.tagName != 'td':
                continue
            tds.append(td)
        if len(tds) != 6:
            continue
        #print tds
        trip = []
        for td in tds:
            #if td.firstChild.nodeType == td.ELEMENT_NODE and td.firstChild.tagName == 'a':
            #    td = td.firstChild
            trip.append(getText(td.childNodes, True))
        trips.append(trip)
 
    trip_number = 0
    for tbody in detail_from.getElementsByTagName('tbody'):
 
        route = []
        for tr in tbody.childNodes:
            if tr.nodeType != tr.ELEMENT_NODE or tr.tagName != 'tr':
                continue
 
            section = []
            for td in tr.childNodes:
                if td.nodeType != tr.ELEMENT_NODE or td.tagName != 'td':
                    continue
                section.append(td)
 
            if getText(section[1].childNodes) != 'ab':
                continue
            route.append((
                getText(section[0].childNodes, True),
                getText(section[4].firstChild.childNodes, True),
                getText(section[2].childNodes),
            ))
 
        if len(route):
            #print route
            trips[trip_number].append(route)
        trip_number += 1
 
    return trips
 
def getDatetimeArg(dt):
    return ('%s.%s.%s' % (dt.day, dt.month, dt.year),
            '%s.%s' % (dt.hour, dt.minute))
 
if __name__ == '__main__':
    if len(sys.argv) != 3:
        print 'Usage %s [start-haltestelle] [end-haltestelle]' % sys.argv[0]
        sys.exit(0)
 
    try:
        while True:
            dep_dt = datetime.datetime.now()
            print 'Zeit der Abfrage:', dep_dt.strftime('%H:%M')
            trips = getTrips(sys.argv[1], sys.argv[2], getDatetimeArg(dep_dt))
            time_to_sleep = None
            for trip in trips:
                start = time.strptime(trip[1], '%H:%M')
                next_dt = datetime.datetime.combine(dep_dt.date(), datetime.time(start.tm_hour, start.tm_min))
                print 'ab %s an %s dauer %s umsteigen %s' % (trip[1], trip[2], trip[3], trip[4])
                for step in trip[6]:
                    print ' > ab %-8s %-16s %s' % step
 
            time.sleep(60)
            print
 
    except KeyboardInterrupt:
        sys.exit(0)

Categories: fun, nerdcore, software Tags:

sshkeygen.com: A web-based ssh key generator

April 9th, 2010 2 comments

http://thunk.org/tytso/blog/2010/04/08/sshkeygen-com-a-web-based-ssh-key-generator/trackback/

Categories: Uncategorized Tags:

Feierabend!

August 11th, 2009 1 comment

http://www.meettheitchicks.com/

Categories: Uncategorized Tags:

–inverse

July 9th, 2009 3 comments

Just read this mail in the coreutils-bugs mailing-list:

Hi,

There appears to be a bug in coreutils. The –inverse flag appears to
be missing or broken from most utils.
Example:

$ ps –inverse
– ERROR: Unknown gnu long option.
$ ls –inverse
ls: unrecognized option `–inverse’
$ rm –inverse foo
rm: unrecognized option `–inverse’
$ echo –inverse “hello”
–inverse hello

Clearly this is not whats expected..
I would expect to receive a list of all processes currently not
running
, all files not in the current working directory, delete all
files not named foo in the current working directory and echo all text
besides “hello”
.

Is this bug fix on the current roadmap? When can I expect it to be fixed?

Thanks very much!
Dan.

PS: highlighting by me

Categories: Uncategorized Tags:

ssh-argv0: for the lazzy ‘ssh’ typer

June 9th, 2009 1 comment

Those of us who often use often ssh to login or start remote commands will find this useful:

$ ln -s /usr/bin/ssh-argv ~/bin/$HOST
$ $HOST

You can use the FQDN of the host of course, but a short alias is even more shorter. Put this in your .ssh/config and use the alias for the link:

Host $FQDN $ALIAS
  HostName $FQDN

And yes, you want to put both $FQDN and $ALIAS in the Host line. If you ever add more options to this Host entry you want to apply it to both $FQDN and $ALIAS. If you omit $FQDN the options will only apply to the $ALIAS.

Categories: linux, software Tags: