Skip to content

Instantly share code, notes, and snippets.

View jezdez's full-sized avatar
🚴
💨

Jannis Leidel jezdez

🚴
💨
View GitHub Profile
@carljm
carljm / runner.py
Created December 9, 2011 04:07
Unittest2 test discovery and real dotted-path named test selection for Django
"""
An alternative Django ``TEST_RUNNER`` which uses unittest2 test discovery from
a base path specified in settings, rather than requiring all tests to be in
``tests`` module of an app.
If you just run ``./manage.py test``, it'll discover and run all tests
underneath the ``TEST_DISCOVERY_ROOT`` setting (a path). If you run
``./manage.py test full.dotted.path.to.test_module``, it'll run the tests in
that module (you can also pass multiple modules).
@kennethreitz
kennethreitz / install-pygame.sh
Created December 18, 2011 12:19
installing pygame
brew install mercurial
brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
pip install hg+http://bitbucket.org/pygame/pygame
@gvalkov
gvalkov / pip help
Created January 3, 2012 20:19
pip help proposal
Usage: pip <command> [options]
Commands:
bundle create pybundle
freeze list installed packages
help show available commands
install install packages
search search pypi
uninstall uninstall packages
unzip unzip individual packages
@idan
idan / storage.py
Created January 19, 2012 08:11
Django-staticfiles with storage on S3, delivering Protocol-relative URLs
from urlparse import urlsplit, urlunsplit
from storages.backends.s3boto import S3BotoStorage
from staticfiles.storage import CachedFilesMixin
class ProtocolRelativeS3BotoStorage(S3BotoStorage):
"""Extends S3BotoStorage to return protocol-relative URLs
See: http://paulirish.com/2010/the-protocol-relative-url/
"""
@honza
honza / gist:1791644
Created February 10, 2012 18:56
uglify js compiler filter for django-compressor
from compressor.filters import CompilerFilter
class UglifyFilter(CompilerFilter):
command = "uglifyjs"
#!/usr/bin/env python
import sys
import urllib2
import bz2
import csv
from StringIO import StringIO
package_name, year_month = sys.argv[1:3]
@kracekumar
kracekumar / core.py
Created March 4, 2012 09:45
parallelpip demo
#! -*- Coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
import gevent
import time
from envoy import run
from sys import exit, argv
import subprocess
import pip
@datagrok
datagrok / gist:2199506
Last active December 16, 2024 16:14
Virtualenv's `bin/activate` is Doing It Wrong
@imlucas
imlucas / add_users.py
Created April 12, 2012 12:58
Using Amazon Cloudsearch with Python and Boto
from cloudsearch import connect_cloudsearch, get_document_service
endpoint = 'paste your doc service endpoint here'
service = get_document_service(endpoint=endpoint) # Get a new instance of cloudsearch.DocumentServiceConnection
# Presumably get some users from your db of choice.
users = [
{
'id': 1,
@codysoyland
codysoyland / gist:2505907
Created April 27, 2012 04:45
stupid gevent memcache server
from gevent.server import StreamServer
#import gevent
import time
class ClientDisconnected(Exception):
pass
class Handler(object):
def __init__(self, cache, socket, address):
self.cache = cache