## October 22, 2014

### How to Sign Gmail Using PGP

The shell script below, written using bash takes the contents of the clipboard, signs it with GPG and pastes the signed content on the clipboard. The pbcopy and pbpaste commands are Mac-specific, so it restricts you to that platform.

## October 18, 2014

### How to Manage pf Rules

The above script manage a pf ruleset. It does rely on your services file being located at /etc/services, which if you're using pf, ought not be a problem. Planned functionality include allowing for destination-specific rules, writing to remote locations, differentiating UDP, TCP, and ICMP, and anything else the lot of you leave a comment requesting. If you get impatient, the source will always be in the embed above.

## October 16, 2014

### How to Track Spending with Procmail.py

A few days ago, I posted code to process email along with examples of processing receipts. Today, I'll present how to sum up whatever receipts have been logged for any month:

## October 11, 2014

### How to Script your Email

The above script is a what I use to automate my email. If you'd like to add an action to it, here's what you need to do:

1. Write a method to do what you want.
2. Write a filter to identify what messages you want your plugin to act on.
3. Add said filter as another elif in the main while loop.
4. Finally, let me know what you've done, if you'd like. I'm genuinely fascinated with what the lot of you come up with.

## October 9, 2014

### How to Justify Finding a Bug

The above code, cribbed from Bruce Dawson's weblog, purportedly shows a bug in Intel's firmware. Compiling the code with gcc, on NetBSD 6.1.4 and running it gives the following results:

% ./pitest
pi = 3.141592653589793115997963468544185
+ 0.000000000000000122460635382237726
3.141592653589793238458598850781911*
Arithmetic gives 3.141592653589793238458598850781911, but $sin ( \pi ) = 0$ so it ought to be closer to the first value than it is. The good news is that Intel is updating their documentation.

## October 8, 2014

### How to Draw a Histogram in Python Using Matplotlib

The code below shows a histogram using the pydata's data analysis tools of the hours when I've sent some of you lot links.

... results in the graph below:

## October 5, 2014

### How to tell what time it is anywhere on Earth

Bit of a change from the usual python or R that inhabits this blog, and not really impressive either, but it does solve the problem of knowing what time it is on dodgier corners of the planet than this one (eg every one, IMO :) ):

#!/bin/sh
case $1 in -z) env TZ=$2 date
;;
-h) echo "\$0 -z [timezone listed in /usr/share/zoneinfo, defaults to localtime]"
;;
*) date
;;
esac
And executing this, a few times, to illustrate the paths of execution:

% sh ./bin/worldtime.sh -z HongKong
Sun  5 Oct 2014 15:09:46 HKT
% sh ./bin/worldtime.sh
Sun  5 Oct 2014 00:10:48 PDT
% sh ./bin/worldtime.sh -h
./bin/worldtime.sh -z [timezone listed in /usr/share/zoneinfo, defaults to localtime]