Skip to content

Instantly share code, notes, and snippets.

@robhudson
robhudson / gist:202599
Created October 5, 2009 23:39
Super minimal Disqus API client
"""Super minimal Disqus API client"""
import urllib
try:
import json
except ImportError:
import simplejson as json
class DisqusClient(object):
@robhudson
robhudson / clean_settings.py
Created May 28, 2009 14:06
Cleaned up and alphabetical settings
import os
PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
ADMINS = (('Your Name', '[email protected]'),)
ADMIN_MEDIA_PREFIX = '/static/admin/'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '',
'USER': '',
@robhudson
robhudson / gist:118990
Created May 28, 2009 00:02
Copy/Paste to print SQL in the Django shell
"""
A quick copy/paste action you can drop into your `./manage.py shell` session so any
queries executed are displayed in the shell output.
If sqlparse is available it will use that to pretty print the SQL:
http://code.google.com/p/python-sqlparse/
"""
from django.db.backends import util
try:
import sqlparse
from mimetypes import guess_type
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import Storage
from django.utils.encoding import iri_to_uri
import re
try:
import S3
except ImportError:
raise ImproperlyConfigured, "Could not load amazon's S3 bindings.\
@robhudson
robhudson / ipy_user_conf.py
Created March 20, 2009 22:08 — forked from jacobian/ipy_user_conf.py
Fork of Jacob's ipython config to make the prompt just like standard Python
import os
import time
import readline
import ipy_defaults
import IPython.ipapi
import ipy_stock_completers
ip = IPython.ipapi.get()
o = ip.options