Import Lufthansa Miles&More Credit Card Statements into GnuCash

GnuCash can import transactions in many formats. Unfortunately, my Lufthansa Miles&More Credit Card only makes statements available as PDFs. This little script uses poppler’s pdftotext tool to extract the statement information, and converts it into a CSV file that is directly importable into GnuCash.

Finance::Quote Module for Comdirect Bank

GnuCash uses Finance::Quote to retrieve current stock prices and exchange rates. It comes with a gazillion modules, all of which seem to be in various stages of disrepair, with the end result being that I couldn’t find one that would work for my mutual funds. So now there is yet another module, which works with my bank: Comdirect.pm

To use, copy the file into the Finance/Quote subdirectory of the Finance::Quote module. You need to also edit the Finance/Quote.pm file and add “Comdirect” to the list of available modules in the “new” method (@modules array around line 176.) Finally, you need to install the HTML::TokeParser::Simple module from CPAN.

AppleTV IPv6 Router

Originally, I had hoped to use my Apple Airport Extreme as the IPv6 router for my home network, since it can act as a tunnel anchor for the IPv6 tunnel I obtained from sixxs.net. Unfortunately, that functionality currently only works when the uplink IPv4 address is statically configured (i.e., no DHCP). My ISP doesn’t support that; even for “static” addresses I still need to run DHCP. So instead, I hacked my AppleTV to be the tunnel anchor and route IPv6 in and out of my home. Here’s how I did it.

Project Name Generator

Tired of thinking up slick acronyms for DARPA, NSF or EU proposals? This little script ( pname.pl ) does it for you. Hand it a phrase and it will grind away, looking for any ordered character subsequence that is an English word:

[eggert@lars: ~] pname.pl domain name system

daisy       DomAIn name SYstem
dames       DomAin naME System
dimes       DomaIn naME System
dines       DomaIN namE System
doest       DOmain namE SysTem
domain      DOMAIN name system
domains     DOMAIN name System
domes       DOMain namE System
dominate    DOMaIN nAme sysTEm
...

DOMINATE is just so much cooler than DNS, and DAISY so much cuter…

Miscellaneous IETF Scripts

I’ve hacked together various scripts related to the IETF. These have some local things hardcoded (paths, etc.), so you will need to tweak them a bit.

  • find-replaced-by attempts to identify Internet Drafts that have been replaced by other Internet Drafts, so the IETF Secretariat can update its databases
  • idreview retrieves an Internet Draft and runs it through idnits, a spell checker ( aspell ), a grammar checker ( languagetool ), and checks the well-formedness of any XML ( xmllint ) and ABNF ( bap )
  • iesgreview retrieves the biweekly IESG telechat agenda and runs idreview over each Internet Draft on it
  • id2bib makes BibTeX citations for all Internet-Drafts
  • rfc2bib makes BibTeX citations for all RFCs

Maybe someone else finds these scripts useful.

Mailboxlist-Filtering IMAP Proxy

Apple Mail looks pretty slick, but its IMAP support is rudimentary at best. For starters, it doesn’t even let you subscribe to mail folders selectively! When you work at a place that has a couple of thousand shared folders, that’s not very useful.

Enter this little perl script ( imapfilter.pl ). It’s an IMAP proxy that runs on your local machine and filters the full list of mail folders returned by the IMAP server before handing the result to the mail client. This effectively hides all folders by default, only showing the ones you told it to let through. (Nothing else - mail content, for example - is filtered.)

You have to edit the source to point it at your IMAP server and edit an ugly regexp to change the filter, but it’s still better than waiting for thousands of folders to synchronize. Also, you need to install the IO::Socket::SSL perl library, which doesn’t come with the MacOS X perl. I suggest you use fink for this. Also note that if something goes wrong, the script logs diagnostics to /var/log/system.log.

Put something like this in /etc/crontab to have it start at each boot, assuming you have installed the script as /usr/local/bin/imapfilter.pl:

@reboot  root  env PERL5LIB=/sw/lib/perl5:/sw/lib/perl5/darwin /usr/local/bin/imapfilter.pl

Jeffrey Wescott suggested this way to autostart the script for all users of a machine and it seems to work more reliably:

# sudo defaults write com.apple.loginwindow LoginHook /usr/local/bin/imapfilter.pl

Stephan Roth suggested yet another way to autostart the script, by copying this file into ~/Library/LaunchDeamons/de.larseggert.imapfilter.plist. (I have not tested this method.)

Update (2007-7-18): I no longer maintain this, thanks to working at a place that doesn’t use public folders.

Convert IETF Agendas to ical Format

This is a small perl script ( ietf2ical.pl ) that imports the ASCII agenda for an IETF meeting into Apple iCal. Once it’s in there, you can then share it with the world (or not.)

Not for the faint of heart! One, because the IETF secretariat likes to change the format of the ASCII agenda from meeting to meeting, so this thing requires constant tweaking. Two, because I really wanted to try scripting MacOS X applications with perl, so this thing grabs stuff off the web, munges it badly and then shoots AppleEvents off to iCal in the vain hope of triggering some sort of response. Don’t blame me if it messes up your iCal data! But when it works, it works well enough.

Obsoleted by https://tools.ietf.org/agenda/.

Mail Stats

This script ( mail-stats.pl ) takes an mbox-format mail folder and computes a histogram of emails per day, ready for feeding into gnuplot. I used to run this on my spam folder to see how well my filters were doing.

KAME Idletime Scheduler Patch

This is a patch that implements idletime scheduling for the disk and network interfaces in FreeBSD. It is based on a 2002-10-28 snapshot of the KAME FreeBSD-4.7-SNAP code, which unfortunately isn’t available on the KAME site anymore but may be gotten through their CVS. With a little work, this may well be ported to recent FreeBSD trees that incorporate the KAME ALTQ framework. Use at your own risk - “research quality” code.

FreeBSD Bridging Fixes

This is a set of patches that we used with the TetherNet client boxes. The FreeBSD 4.7-RELEASE bridging code has two shortcomings:

  1. When a DHCP server runs on an interface that is part of a bridge set but has no carrier, DHCP requests from clients connected to other interfaces of the bridge set fail. This is because FreeBSD’s ISC DHCP server uses bpf to capture incoming requests, and such bridged client requests are dropped on interfaces with no carrier before they reach the bpf. (The ISC DHCP server should really be using RawIP.) This is fixed by the first patch.
  2. Placing IPv6-enabled interfaces in a bridge set causes stateless auto-configuration to fail. IPv6 stateless auto-configuration is based on link-local addresses, and bridging causes link-local addresses associated to one interface to appear on another. As a work-around, the second patch prevents IPv6 packets from being bridged at all; this at least allows a routed IPv6 configuration to coexist with a bridged IPv4 one. (Much more extensive changes to the bridge code are required to cleanly integrate bridging and IPv6.)

IPdump

IPdump is a tool to generate detailed packet header dumps from packet traces in LBNL’s libpcap format, such as generated by tcpdump. Ethereal is a vastly superior program (that wasn’t available when I wrote this), but IPdump is still sometimes useful when post-processing dumps with pipes and command line tools. IPdump has been open-sourced under the Artistic License, and is hosted on SourceForge now.

Net::SSLeay Patches

Patches to Sampo Kellomäki’s Net::SSLeay perl module. Adds support for registering a password callback and fixing various warning messages. Patches are against version 1.03 of the package, which should be on CPAN. Most of these patches are in Net::SSLeay 1.06.

Ensemble-TCP

TCP currently recalculates the path state of each connection from a fixed set of initial parameters over several round trips, during which the connection can be less than efficient. Ensemble-TCP (E-TCP) shares control block information among connections in series and aggregating it among connections in parallel. It makes the network transmission behavior of group of parallel E-TCP connections closely resemble that of a single TCP/Reno connection. Simulated web accesses using HTTP/1.0 over E-TCP show a significant performance improvement compared to TCP/Reno connection bundles. Please refer to the CCR paper for details on E-TCP, or see RFC 2140 for the general idea.

The E-TCP implementation for the ns network simulator is available. This module was developed for ns-2.1b4, it will possibly break under newer versions.

Webstone Patches

Patches for SGI’s webstone-2.1 providing per-request statistics and significantly improving stability. Webstone is now maintained by Mindcraft, and these patches will very likely not work for their newer versions.

NetPacket::IP Patches

This small patch fixes a bug present in the perl NetPacket-0.03 module that breaks IP checksum calculation. I’ve submitted it back to the authors. (The bug is still present in NetPacket-0.04. The FreeBSD port now includes this bugfix.)