Software
Here I'm making some of the software I've written over the years available.
Here I'm making some of the software I've written over the years available.
I wrote this little script to monitor traffic on various machines at work. We use Shorewall to set up all the netfilter rules, traffic shaping, etc. It also makes it easy to set up rules to monitor traffic for different types of traffic. We use Munin to track all sorts of things over time. The script below is a Munin plugin that will create a graph with one data series for each of the chains defined in your shorewall accounting file. Put this script into /etc/munin/plugins and call it something like shorewall_accounting, and then add this in /etc/munin/plugin-conf.d/munin-node:
[shorewall_accounting] user rootThe name in between the square brackets should match the name of the file you saved the script in. The script needs to run as root in order to get access to iptables. Edit Jan 20, 2006: Some minor bugfixes to the script have now been included. The shorewall accounting chains are now output in alphabetical order, and the regexp has been fixed to catch very large numbers.
#!/usr/bin/python
# shorewall_accounting
# A munin plugin for tracking traffic as recorded by shorewall accounting rules
# Written by Chris AtLee
# Released under the GPL v2
import sys, commands, re
accountingLineExp = re.compile(r"^\s*\d+\s+(\d+)\s+(\w+).*$")
def getBytesByChain():
status, output = commands.getstatusoutput("shorewall -x show accounting")
if status != 0:
raise OSError("Error running command (%s)[%i]: %s" % (trafficCmd, status, output))
chains = {}
for line in output.split("\n"):
m = accountingLineExp.match(line)
if m is not None:
target = m.group(2)
bytes = int(m.group(1))
if target in chains:
chains[target] += bytes
else:
chains[target] = bytes
retval = []
chainNames = chains.keys()
chainNames.sort()
for name in chainNames:
retval.append((name, chains[name]))
return retval
if len(sys.argv) > 1:
if sys.argv[1] == "autoconf":
print "yes"
sys.exit(0)
elif sys.argv[1] == "config":
print "graph_title Shorewall accounting"
print "graph_category network"
print "graph_vlabel bits per ${graph_period}"
for chain,bytes in getBytesByChain():
print "%s.min 0" % chain
print "%s.type DERIVE" % chain
print "%s.label %s" % (chain, chain)
print "%s.cdef %s,8,*" % (chain, chain)
sys.exit(0)
for chain, bytes in getBytesByChain():
print "%s.value %i" % (chain, bytes)
apt-get install debian-archive-keyringwill also work :) This package was added just a few hours ago.
I got sick of Thunderbird opening up links in Mozilla instead of Firefox. A friend mentioned that the preference responsible for opening up links was 'network.protocol-handler.app.http'. I searched around in the Thunderbird pref files for what it was currently using. On my machine it was set to launch 'x-www-browser'. This is actually a symlink into Debian's alternatives directory, so a simple
update-alternatives --set x-www-browser /usr/bin/firefox
did the trick.
As root (this should be all one line):
wget -q -O - http://ftp-master.debian.org/ziyi_key_2005.asc http://ftp-master.debian.org/ziyi_key_2006.asc | apt-key add -The debian-keyring package should probably have these keys included, but it doesn't seem to.
I've written before about my experiences with printing under Linux...Initial frustration, brief elation, and then final disappointment while attempting to set up my Lexmark Z42. Eventually I gave up and either printed everything at work, or from my wife's laptop. A recent sales flyer from a local computer store, combined with some mail-in-rebate programs by the manufacturors convinced me that the time had come to try another printer. My in-laws purchased an all-in-one multifunction printer / scanner / copier last year and were very happy with it, and actually made good use of the copying functionality of the machine. So the question was, which model would I buy? I knew for sure that I wouldn't get Lexmark after my horrible experience with the Z42 last time. My instinct was justified after reading linuxprinting.org's page on suggested printers for free software users:
There are few good free software drivers for Canon and Lexmark inkjets. Do not buy one and expect success.The same page recommended either an Epson or HP printer, and as there was a sale on Epson printers I decided to go with Epson. Now, which model to get? It really came down to the choice between the Epson CX4200 and the Epson CX4800. The CX4800 has the ability to put in a memory card and print directly from the card. However, since I don't expect to be printing pictures at home at all, this feature really isn't necessary for me. CX4200 it is then! Setting up this printer was a snap in Linux. Actually even easier than setting it up in Windows, which is a nice change! I simply used the Gnome CUPS Manager to add a new printer, and selected mine from the list. I already had the Gutenprint v5 drivers installed, so I guess that's where a lot of the credit for ease of installation is due. Setting up scanning was a bit trickier. I had to manually edit some of the sane configuration files, and there seemed to be an issue where the printer module would claim exclusive access to the usb device, preventing the scanner module from working. This is apparently fixed in later versions of the drivers, but I haven't had a chance to test it out. The CX4200's print quality is good for what I use it for, which is mostly just printing out e-mails, directions, recipes and things of that sort which would be time consuming to copy to paper by hand. The standalone copying functionality is very handy, I've used it quite a bit so far. Almost as much as printing from my computer! So far I'm very happy with the CX4200, and at $70 (CAD) after a mail-in-rebate, the price can't be beat.
I started listening to some podcasts back in December...The funniest thing got me started: a post on comp.lang.python was adversiting a podcast of the newsgroup as read by pyTTS. Since I started listening to podcasts back in December I have subscribed to a number of podcasts, and have been falling behind listening to them...Travis warned me that would happen! As I write this I have 780 MB of podcasts that have been downloaded but never listened to. Right now I'm listening to these podcasts:
I was setting up a machine to handle some of our backups at work. It's not a critical system, so instead of setting up a RAID across 3 250GB drives, I just set up LVM so I could take advantage of all 750GB. This were going along fine, but then I wanted to see what the status of LVM was...So I ran 'lvdisplay' and got this very disturbing message:
A co-worker of mine recently posted the following tip to an internal wiki:
Many people go to extraordinary lengths to escape slashes for use in the sed-style s/foo/bar/g command found in VIM, perl, sed, and many other tools. What's not widely known is that you can, in fact, use any character in place of those slashes. I regularly do something like this:
sed -e 's,/usr/bin,/home/bin,g'
I blame gnu info for me not knowing this. I only use 'man', but lots of content is only available in 'info' pages. I never really understood why.