This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An example of the below | |
virtualenv "/home/dvcsmirrors/hg" do | |
owner "root" | |
group "dvcsmirrors" | |
mode 0775 | |
packages "Mercurial" => "1.6.3", | |
"hgsubversion" => "1.1.2" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /home/dvcsmirrors/hg/django && /home/dvcsmirrors/hg/bin/hg pull -q subversion && /home/dvcsmirrors/hg/bin/hg push -q bitbucket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with run_in_parallel(): | |
run('...') | |
run('...') | |
local('...') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import mechanize | |
from xml.etree import cElementTree | |
USERNAME = '...' | |
PASSWORD = '...' | |
NUMBER = '2025551212' | |
br = mechanize.Browser() | |
br.open('https://ebillpay.verizonwireless.com/vzw/accountholder/overview/AccountOverview.action') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is a test settings file suitable for running Django's under a build slave. | |
Out of the box it's configured to run tests against SQLite, but there are | |
examples below, commented out, to run tests against MySQL and PostgreSQL. | |
The important parts: | |
* You must have two databases: "default" and "other". | |
* For all databases except SQLite, the "default" database must exist and you | |
must be able to connect to it given the creds in the settings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Nagios plugin to check PostgreSQL 9 streaming replication lag. | |
Requires psycopg2 and nagiosplugin (both installable with pip/easy_install). | |
MIT licensed: | |
Copyright (c) 2010 Jacob Kaplan-Moss. All rights reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import template | |
from django.template import defaulttags | |
from django.utils.safestring import mark_for_escaping | |
register = template.Library() | |
class EscapedNode(template.Node): | |
def __init__(self, node): | |
self.node = node | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def elem2dict(node): | |
""" | |
Convert an lxml.etree node tree into a dict. | |
""" | |
d = {} | |
for e in node.iterchildren(): | |
key = e.tag.split('}')[1] if '}' in e.tag else e.tag | |
value = e.text if e.text else elem2dict(e) | |
d[key] = value | |
return d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def start_replication(): | |
""" | |
Begin Postgresql standby | |
""" | |
# Stop pg on the slave machine. | |
with settings(host_string=env.db_slave): | |
run('service postgresql-9.0 stop') | |
# Create the backup on the master machine | |
with settings(host_string=env.db_master): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Basic daemon config | |
ServerRoot "/etc/apache2" | |
PidFile ${APACHE_PID_FILE} | |
User ${APACHE_RUN_USER} | |
Group ${APACHE_RUN_GROUP} | |
ServerTokens ProductOnly | |
ServerAdmin [email protected] | |
### Listen on localhost:8000 (behind the proxy) |