Skip to content

Instantly share code, notes, and snippets.

@cboddy
cboddy / thunderbird_to_mutt.py
Created October 8, 2016 15:29
A script to parse a csv address-book export from thunderbird and create mutt-aliases for each contact.
"""parse a csv address-book export from thunderbird and create mutt-aliases for each contact"""
import csv
import collections
import argparse
Contact = collections.namedtuple("Contact", ["first", "last", "email"])
def line_to_contact(line):
"""return: Contact based on csv line"""
@cboddy
cboddy / service-checklist.md
Created September 28, 2016 12:14 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@cboddy
cboddy / pre-commit
Last active December 3, 2019 00:09
pre-commit git hook for python projects to run autopep8 linter
#!/bin/bash
# run autopep8 linter on any python files that are part of the commit
# and modify them in-place to conform to pep8
git diff --cached --name-only | egrep '\.py$' | xargs --no-run-if-empty autopep8 -ri
# re-index files staged for commit
git diff --cached --name-only | egrep '\.py$'| xargs -l git add
@cboddy
cboddy / deploy.py
Created October 17, 2015 14:10
A simple, generalised app deploymeent script over SSH with up-start runtime-management.
from subprocess import Popen
import argparse, os, os.path, shutil
upstart_template = """
description "$NAME service runtime"
author "[email protected]"
# Start on startup