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
######################################################### | |
# Title: Simple ElementTree accessor # | |
# Author: Alexander Artemenko <[email protected]> # | |
# Site: http://aartemenko.com # | |
# License: New BSD License # | |
# Original: http://gist.github.com/108704 # | |
######################################################### | |
class Accessor(object): | |
"""Easy to use ElementTree accessor.""" |
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 logging | |
root = logging.getLogger() | |
handler = logging.FileHandler('debug.log') | |
fmt = logging.Formatter('%(asctime)s %(process)s/%(thread)s %(levelname)s %(name)s %(filename)s:%(lineno)s %(message)s') | |
handler.setFormatter(fmt) | |
root.addHandler(handler) |
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
class QuerySetDoubleIteration(Exception): | |
"A QuerySet was iterated over twice, you probably want to list() it." | |
pass | |
# "Skinny" here means we use iterator by default, rather than | |
# ballooning in memory. | |
class SkinnyManager(Manager): | |
def get_query_set(self): | |
return SkinnyQuerySet(self.model, using=self._db) |
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.conf import settings | |
from functools import wraps | |
class _s: | |
def __init__(self, a=10, b=None): | |
self.a, self.b = a,b | |
def _override_settings(overrides): | |
_orig = {} | |
_missing = [] |
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
#!/bin/bash | |
# A script to build Django from the given SVN revision | |
REV=$1 | |
UPLOAD_TO=locum:www/pypi | |
pushd . | |
svn co -r $REV http://code.djangoproject.com/svn/django/trunk/ django-$REV | |
cd django-$REV |
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
#!/bin/zsh | |
BINDIR="${HOME}/.tools/bin" | |
QUICKLISPDIRNAME=".quicklisp" | |
WORKINGLISPDIR="${HOME}/Dynamics/sbcl" | |
EMACS_CL=emacs | |
() { | |
[[ -a "${HOME}/.emacs.d/data/.launched" ]]\ | |
&& which emacs-cl > /dev/null 2>&1\ | |
&& EMACS_CL=emacs-cl | |
} |
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
data:text/html;base64,PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uZXtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtyaWdodDowO2JvdHRvbTowO2xlZnQ6MDt9PC9zdHlsZT48ZGl2IGNsYXNzPSJlIiBpZD0iZWRpdG9yIj48L2Rpdj48c2NyaXB0IHNyYz0iaHR0cDovL2QxbjB4M3FqaTgyejUzLmNsb3VkZnJvbnQubmV0L3NyYy1taW4tbm9jb25mbGljdC9hY2UuanMiIHR5cGU9InRleHQvamF2YXNjcmlwdCIgY2hhcnNldD0idXRmLTgiPjwvc2NyaXB0PjxzY3JpcHQ+dmFyIGU9YWNlLmVkaXQoImVkaXRvciIpO2Uuc2V0VGhlbWUoImFjZS90aGVtZS90d2lsaWdodCIpO2UuZ2V0U2Vzc2lvbigpLnNldE1vZGUoImFjZS9tb2RlL21hcmtkb3duIik7PC9zY3JpcHQ+ |
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
;; -*- mode: lisp -*- | |
;; | |
;; A quick and dirty tree shaker for SBCL. Basically, it destroys the | |
;; package system and does a gc before saving the lisp image. Gives | |
;; about a 40% reduction in image size on a basic hello world test. | |
;; Would like to hear how it works on larger projects. | |
;; | |
;; Original idea from: https://groups.google.com/d/msg/comp.lang.lisp/6zpZsWFFW18/WMy4PyA9B4kJ | |
;; | |
;; Burton Samograd |