Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
worker_processes 2; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
use epoll; | |
} |
import logging | |
l = logging.getLogger('django.db.backends') | |
l.setLevel(logging.DEBUG) | |
l.addHandler(logging.StreamHandler()) |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/usr/bin/env python | |
# -*- python -*- | |
# | |
# Plugin to track account balances on ingdirect.com.au, using selenium gymnastics to log in | |
# | |
# E.g. | |
# ln -s /usr/share/munin/plugins/ingdirect.py /etc/munin/plugins/ingdirect | |
# | |
# Needs (hint: pip install): | |
# selenium |
#! /usr/bin/env python | |
from boto.ses.connection import SESConnection | |
import os | |
import sys | |
import subprocess | |
import socket | |
TMPFILE = '/var/run/postgresql/last-wal-archive-error-file.tmp' | |
if __name__ == '__main__': |
# Based on https://github.com/ansible/ansible/blob/devel/examples/playbooks/postgresql.yml | |
--- | |
- hosts: postgres.vm | |
sudo: yes | |
tasks: | |
- name: ensure latest postgres & postgis packages are latest | |
action: apt pkg=$item update_cache=yes state=latest | |
with_items: |
# rsyslog v5 configuration file | |
#### MODULES #### | |
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command) | |
$ModLoad imklog # provides kernel logging support (previously done by rklogd) | |
#$ModLoad immark # provides --MARK-- message capability | |
# Provides UDP syslog reception | |
$ModLoad imudp |
# -*- coding: utf-8 -*- | |
"""Add permissions for proxy model. | |
This is needed because of the bug https://code.djangoproject.com/ticket/11154 | |
in Django (as of 1.6, it's not fixed). | |
When a permission is created for a proxy model, it actually creates if for it's | |
base model app_label (eg: for "article" instead of "about", for the About proxy | |
model). |