Skip to content

Instantly share code, notes, and snippets.

View paltman's full-sized avatar

Patrick Altman paltman

View GitHub Profile
Hosting Sphinx docs at GitHub
-----------------------------
Before: Run sphinx-quickstart in docs/
1. Follow "Project Pages" instructions from http://pages.github.com/ to create a gh-pages branch
2. Add Sphinx html build dir as git submodule:
git checkout master
git submodule add -b gh-pages git@github.com:arthurk/django-disqus.git docs/_build/html
#!/bin/python
import os
import sys
def enum_urls(package_root):
for path, dirs, files in os.walk(os.getcwd()):
if package_root in path:
for f in [os.path.join(path, filename).replace(os.getcwd()+'/', '').replace('/', '.').replace('.py', '') for filename in files if filename == 'urls.py']:
print f
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'
from httplib import HTTPConnection
from urlparse import urlparse
def checkURL(url, timeout=2):
p = urlparse(url)
h = HTTPConnection(p[1], timeout=timeout)
h.putrequest('HEAD', p[2])
h.endheaders()
if h.getreply()[0] == 200: return 1
else: return 0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>saveActiveFile</string>
<key>bundleUUID</key>
<string>E4A0D653-1058-42CF-91C5-52D78242CC7A</string>
<key>capturePattern</key>
<string>^(.*)\s+line:\s+(\d+)\s+col:\s+(\d+).*$</string>
diff --git a/boto/s3/__init__.py b/boto/s3/__init__.py
index be2de1d..f3f4c1e 100644
--- a/boto/s3/__init__.py
+++ b/boto/s3/__init__.py
@@ -1,4 +1,6 @@
-# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2010, Eucalyptus Systems, Inc.
+# All rights reserved.
#
diff --git a/boto/ec2/address.py b/boto/ec2/address.py
index b2af107..60ed406 100644
--- a/boto/ec2/address.py
+++ b/boto/ec2/address.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2006-2008 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
diff --git a/boto/sqs/20070501/__init__.py b/boto/sqs/20070501/__init__.py
deleted file mode 100644
index 561f9cf..0000000
--- a/boto/sqs/20070501/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
@paltman
paltman / gist:654943
Created October 30, 2010 04:22
Cool way of running django's test runner on individual django apps / from carl
#!/usr/bin/env python
from os.path import dirname, abspath
import sys
from django.conf import settings as django_settings
if not django_settings.configured:
django_settings.configure(
DATABASE_ENGINE='sqlite3',
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