Archive for October, 2011

Doing horrible things to fix problems in apt

If a dpkg package is refusing to install on an ubuntu machine it is possible to tweak the installation process until it does work.

There script files in /var/lib/dpkg/info are run to perform various dpkg operations. By tweaking these fills you can fix a package which is refusing to install. Needless to say this is evil and dangerous.


October 22, 2011 at 1:25 am Leave a comment

Making ipython less ugly

Ipython is a better shell than the python shell, this much should be clear, it supports:

* Completion
* Better plotting of graphs using matplotlib
* Magic return values for every expression you write _1 etc
* pretty printing by default

However despite this I didn’t use it for a long time, and this was for only one reason: It’s ugly.

To be more specific:
* The initial banner takes up half a screen
* It prints out too many newlines.

Since I appear to be spending this evening yak-shaving, I’ve decided to make ipython less ugly, and therefore just about useable.

=== Making ipython useable ===

==== Removing hideous banner ====

Knowing the version of python you are using is pretty useful in server environment, so we still want this in then banner. We just want want less noise. This is acheived by putting the following executable on your path and using it instead of ipython. (I named it ipy).

It seems like you can modify the banner via options alone.

#!/usr/bin/env python

import sys

import IPython.Shell
IPython.Shell.start().mainloop(banner='IPython %s\n' % sys.version)

===== Making the prompts less ugly ====

You can do this via your ipythonrc file. Just take the newline out of prompt_out

prompt_out ‘Out[\#]: ‘

And there we go a useable shell…

October 5, 2011 at 10:38 pm Leave a comment

Automatic security updates on Centos and Redhat

October 2, 2011 at 10:12 pm Leave a comment

Problems when trying to use gmail for mail forwarding

You can set up postfix to forward mail via gmail ( This is nice because it lets you use command line tools to send mail without you have to go the whole hog and implement a mail server.

When I tried to do this I got the following error, despite my dns plainly failing

Oct 2 21:03:20 moment postfix/smtp[14469]: 431DAE045C: to=, relay=none, delay=984, delays=984/0.04/0/0, dsn=4.4.3, status=deferred (
Host or domain name not found. Name service error for type=A
: Host not found, try again)

This mail explained what was going on ( Apparently postfix does its own dns – which is a little crazy, and my resolv.conf file was missing. I think this is ever so slightly broken….

P.S Gmail will mangle your from address but it’s okay for small personal tools.

October 2, 2011 at 8:42 pm Leave a comment

October 2011
« Sep   Nov »