Skip to content

Instantly share code, notes, and snippets.

@GrantTrebbin
GrantTrebbin / MailStat.py
Created Oct 19, 2015
Crudely analyse the emails in an mbox file to generate statistics
View MailStat.py
import mailbox
from email.header import decode_header
import re
import itertools
regex = re.compile('[^a-zA-Z0-9]')
words = []
for message in mailbox.mbox('Inbox.mbox'):
subject, encoding = decode_header(message['subject'])[0]
@GrantTrebbin
GrantTrebbin / QRBackup.sh
Last active Oct 23, 2020
How to encode and decode a file backed up as a series of printed QR codes
View QRBackup.sh
# How to encode and decode a file backed up as a series of printed QR codes
# Install the required tools
sudo apt-get update
sudo apt-get install zbar-tools imagemagick qrencode
################################################################################
# Convert the file to a base 64 encoded format. Probably not needed as QR codes
@GrantTrebbin
GrantTrebbin / imCompress.py
Created May 21, 2015
Compressing Similar PNG Images
View imCompress.py
#!/usr/bin/python
from PIL import Image
import numpy
import argparse
import os
import sys
#Configure argument parser to take input arguments
@GrantTrebbin
GrantTrebbin / si470x_log_processor.py
Created May 10, 2015
Create a series of images to demonstrate weather related events using python and matplotlib
View si470x_log_processor.py
#!/usr/bin/python
import csv
import sys
from datetime import datetime
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.image as image
import matplotlib.lines as mlines
import os.path