Skip to content

Instantly share code, notes, and snippets.

@wkettler
wkettler / tree.py
Last active August 29, 2015 14:11
Autovivification removes need for horrendous nested calls to {}.setdefault() when working with trees in python. my_tree = tree() my_tree['tra']['la']['la']
from collections import defaultdict
def tree():
return defaultdict(tree)
#!/bin/bash
####################################
# Last tested & updated 04/09/2014
####################################
VERS="0.9.12"
# Make sure only root can run script
if [[ $EUID -ne 0 ]]
then
@wkettler
wkettler / carbon-cache
Last active December 25, 2015 14:59 — forked from chalmerj/gist:1492384
#!/bin/bash
#
# carbon-cache
#
# Graphite's carbon-cache daemon init script.
#
# William Kettler <william.p.kettler@gmail.com>
#
# Source init-functions