Skip to content

Instantly share code, notes, and snippets.

View stefanfoulis's full-sized avatar

Stefan Foulis stefanfoulis

View GitHub Profile
@stefanfoulis
stefanfoulis / ubuntu.rst
Created July 19, 2011 08:46
package list for new servers

python stuff that needs to be installed globally

apt-packages:

build-essential
python-setuptools
python-pip
python-imaging
@stefanfoulis
stefanfoulis / readme.rst
Created July 22, 2011 16:19
example supervisord script for starting django and gunicorn

example configuration for supervisord

@stefanfoulis
stefanfoulis / base64field.py
Created August 5, 2011 06:47
Base64 Encoded Field with south support
#-*- coding: utf-8 -*-
# Work in progress. The South part does not work correctly yet!
import base64
from django.db import models
# Stolen from http://djangosnippets.org/snippets/1669/
class Base64Field(models.TextField):
def contribute_to_class(self, cls, name):
#-*- coding: utf-8 -*-
import zbar
from PIL import Image
def read_barcode(path):
scanner = zbar.ImageScanner()
scanner.parse_config('enable')
pil = Image.open(image).convert('L')
width, height = pil.size
raw = pil.tostring()
@stefanfoulis
stefanfoulis / __init__.py
Created August 16, 2011 18:00
PEP386 StrictVersion compliant __version__
#-*- coding: utf-8 -*-
__version_info__ = {
'major': 0,
'minor': 1,
'micro': 0,
'releaselevel': 'alpha',
'serial': 1
}
def get_version(short=False):
#-*- coding: utf-8 -*-
"""
Provides an easy way to turn any ascii string into a funky unicode character massacre.
Example usage:
>>> from unicodefy import unicodefy
>>> print unicodefy(u'We are not ASCII')
Wë ãrè ñót ÅŠÇÎÌ
"""
######################
# Windows
######################
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini

Welcome to Drift!

Drift is an always-already versioned, cloud-backed text editor. You can use it to take notes, and save them in the GitHub cloud.

Your gists are always saved locally, and any changes you make will get pushed to GitHub's servers.

To name a gist, touch its name in the toolbar.

You can use the share button at the top-right to copy a link to one of your gists, or view it on the web in Safari.

"""
Just a quick hack to collect all "media" directories in INSTALLED_APPS instead
of only the "static" directories.
add this to your settings:
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
"myproject.media_staticfiles_finder.AppDirectoriesFinderAsMedia",