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.
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…
Automatic security updates on Centos and Redhat
http://www.serverschool.com/server-configuration/schedule-automatic-updates-in-yum/
Problems when trying to use gmail for mail forwarding
You can set up postfix to forward mail via gmail (http://www.amirwatad.com/blog/archives/2009/03/21/send-email-from-the-command-line-using-gmail-account/http://www.amirwatad.com/blog/archives/2009/03/21/send-email-from-the-command-line-using-gmail-account/). 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 name=smtp.gmail.com type=A
: Host not found, try again)
This mail explained what was going on (http://www.sslug.dk/~chlor/postfix/http://www.sslug.dk/~chlor/postfix/). 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.