Monitoring packet loss on your home internet connection

  1. Get a raspberry pi, install raspbian on it and put it on your home network
  2. Install smokeping (apt-get install smokeping)
  3. Configure smokeping (edit /etc/smokeping/config.d/Targets) so that at least one of the targets is a stable internet host (eg Google DNS Restart
  4. View http://rasp-pi-ip/smokeping/smokeping.cgi
  5. Get sad results like the below :(
smokeping screenshot

smokeping screenshot

Simple example of using the threading Timer class in python

#!/usr/bin/env python
# simple example of threading.Timer in python

import time, threading

class Counter(object):
    def __init__(self, initial = 0, update_interval = 5):
        self.counter = initial
        self.update_interval = update_interval

    def inc(self):
        self.counter += 1
        # Timer only runs once so call recursively in inc()

a = Counter()
b = Counter(50, 10)
c = Counter(1000, 1)

for ct in (a, b, c):
    # increment counter and start timer thread in each object

while True:
    # loop forever
    print "%s %s %s" % (a.counter, b.counter, c.counter)

Emacs vc-mode doesn’t support git push

So here’s a quick function to drop in your ~/.emacs (taken from here):

VirusAction script for clamsmtp

I’ve recently configured my MTA to drop emails with embedded MS Office Macros (a very popular way of distributing malware).

You can get the odd valid macro-enabled Office doc, so I’ve written a script to alert me when emails are dropped, it’s available on GitHub

Configure in /etc/clamsmtpd.conf as below:

(other switches available, read the source or run with -h)