Author Archive

hamfax 0.6.5

June 17, 2011 Leave a comment

After a very long time, i managed to update the hamfax project and create a new release, version 0.6.5. Hopefully, i will find more time to work on the backlog of requests and things that should be done. If you want to contribute, there is a mailing list and the public code repository.

Categories: Linux, programming Tags:

Using googlecl to query google contacts from mutt

June 7, 2011 5 comments

googlecl is a neat tool for accessing the Google Contacts address book from the command line. mutt is a powerful email client that allows calling external tools for accessing an address book. Unfortunately, the output from googlecl is different from the input required by mutt. Here is a simple script that wraps googlecl to be used from mutt. Simply put the code in a file mutt-google-contacts and make it executable. Then call it from mutt by adding this to the ~/.muttrc file:

set query_command = "mutt-google-contacts '%s'"

Here is the script:


# Version 0.1 Copyright (C) 2011 Christof Schmitt
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see

# This script parses the output of 'google contacts list'
# ( and
# prints the queried email address in the format required by mutt
# (
# Usage: Install googlecl from
# and add
# set query_command = "mutt-google-contacts '%s'"
# to ~/.muttrc

import subprocess
import string
import sys

if not len(sys.argv) >= 2:
    print 'Usage: %s querystring' % sys.argv[0]

sys.stdout.write('Calling "google contacts list": ')

query = ' '.join(sys.argv[1:])
args = ['/usr/bin/google', 'contacts', 'list', '--title', '(?i).*' + query,
        '--fields', 'name,email', '--delimiter=;']

google = subprocess.Popen(args, stdout=subprocess.PIPE)
stdout, stderr = google.communicate()

if google.returncode != 0:
    print 'error'

print 'success'

for line in stdout.split('\n'):
    if len(line) > 0:
        name, emails = line.split(';')
        for email in emails.split(', '):
            if string.find(email, ' ') != -1:
                # with two or more addresses there is an additional
                # type (home, work, ...)
                typeoraddr, emailaddr = string.split(email, ' ')
                print emailaddr + '\t' + name + '\t' + typeoraddr
                # with only one address, there is no type field
                print email + '\t' + name
Categories: programming Tags: , ,

Ubuntu 10.04 (Lucid Lynx), Asus Eeepc 901 and wireless networking

March 5, 2011 10 comments

For the record: Ubuntu 10.04 (Lucid Lynx) is working great on the Asus Eeepc 901. Only the support for the RaLink RT2860 wireless chip is not that great, sometimes the system refuses to connect to a wireless network.  The best approach seems to be installing the backport package that brings a newer version of the driver:

sudo apt-get install linux-backports-modules-wireless-lucid-generic

or when the PAE kernel is being used:

sudo apt-get install linux-backports-modules-wireless-lucid-generic-pae

Connectivity is much better for me with the updated driver.

Categories: Linux Tags: , , , , , ,

Perl Programming Best Practices LCA 2011

February 6, 2011 Leave a comment

The first videos are available online. From watching the talk Perl Programming Best Practices, here are some modules and suggestions mentioned in the talk as notes to myself:

  • Always add use strict and use warnings.
  • use autodie allows omitting the or die statements for catching errors.
  • given/when is analogous to switch/case in other languages.
  • say prints a line while automatically adding the newline.
  • Try::Tiny is a CPAN module for try/catch style exception handling.
  • carp and croak should be used to report errors in modules. It is more useful to see where wrong data was passed to the module function, than the exact place where the module called die.
  • App::perlbrew allows installing perl in the home directory.
  • local::lib helps installing perl modules in local directories.
  • Test::More is a module for running tests.
  • Devel::Cover can be used to measure the code coverage.
  • Perltidy reformats perl code to make it easier to read.
  • List::Util has some helper functions for lists (e.g. max, min, sum)
  • Named captures in regular expressions allow using named variables instead of $1, $2, … to extract parts of the original string.

This list is incomplete, and i would highly recommend watching the talk to see everything mentioned there.

Categories: programming Tags:

Please do not throw salami pizza away

July 11, 2010 Leave a comment

Remembering the seven layers of the OSI model for communications and computer networks can be confusing. I like the humorous way of remembering the names with this memorable sentence:

  • Please
  • Do
  • Not
  • Throw
  • Salami
  • Pizza
  • Away.

The first letters map to the names of the different OSI layers:

  • Physical Layer
  • Data Link Layer
  • Network Layer
  • Transport Layer
  • Session Layer
  • Presentation Layer
  • Application Layer

This works at least for computer people enjoying salami pizza. As a sidenote, Layer 8 is not part of the standard OSI model, although it can be important for troubleshooting problems in the real world.

Categories: networking Tags: ,