Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Djangonaut, tree hugger

Scot Hacker shacker

💭
Djangonaut, tree hugger
View GitHub Profile
@shacker
shacker / pg_backup
Created Mar 5, 2014
Get list of all dbs on remote server, dump each to its own dir on this server
View pg_backup
#!/bin/bash
# Get list of all dbs on remote server, dump each to its own dir on this server
export PGPASSWORD="secret"
HOST='example.com'
DBUSER='someuser'
BASEDIR='/var/backups/postgres/'
temp1='/tmp/dbdata_tmp1.txt'
temp2='/tmp/dbdata_tmp2.txt'
@shacker
shacker / debug_loader.py
Created Feb 27, 2014
Template name overlays for Django
View debug_loader.py
from django.template.loader import BaseLoader
from django.template.loader import find_template_loader
from django.template.loader import make_origin
from django.template.base import TemplateDoesNotExist
from django.template.base import Template
'''
Deubug template loader visually shows which templates are being invoked in the
process of rendering an entire page. To use, wrap your your existing loaders
@shacker
shacker / add_members-nomail
Created Oct 20, 2012
Provides an -e flag to Mailmans' 2.x add_members script for nomail delivery option
View add_members-nomail
54a55,58
> --enable-mail=<y|n>
> -e <y|n>
> Enable user mail deilvery options.
79a84
> from Mailman import MemberAdaptor
127c132
< def addall(mlist, members, digest, ack, outfp):
---
> def addall(mlist, members, digest, ack, outfp, enable):
@shacker
shacker / gift-circle.py
Created Dec 5, 2010
Replace "drawing names from a hat" gift exchanges with a quick script
View gift-circle.py
#!/usr/bin/python
'''
Python-based gift exchange randomizer.
Step through a list of people and, for each member of that list,
select someone else to be a recipient of their gift. That recipient:
A) Must not be themselves (no self-gifting)
B) Must not already have been assigned as a recipient