Skip to content

Instantly share code, notes, and snippets.

View pombredanne's full-sized avatar

Philippe Ombredanne pombredanne

View GitHub Profile
@pombredanne
pombredanne / gist:1002493
Created June 1, 2011 15:07 — forked from dap/gist:180477
Openfire to Prosody How-To
How to get sleekmigrate to work as noted at
http://el-tramo.be/blog/openfire-to-prosody-migration on Ubuntu 8.10:
0. Install python-tlslite from the chromium-daily PPA.
See https://launchpad.net/~chromium-daily/+archive/ppa.
1. Make a place to work:
$ mkdir ~/workspace && cd ~/workspace
@pombredanne
pombredanne / resque.py
Created June 2, 2011 07:58 — forked from defunkt/resque.py
Resque client in Python
from redis import Redis
import simplejson
class Resque(object):
"""Dirt simple Resque client in Python. Can be used to create jobs."""
redis_server = 'localhost:6379'
def __init__(self):
host, port = self.redis_server.split(':')
self.redis = Redis(host=host, port=int(port))
votes CF
"back in black" => { 201005211200 => '1', 201005201159 => '1', 201005201157 => '1', 201005011900 => '1', 201004190600 => '1' },
"black album" => { 201005021800 => '1', 201005010600 => '1' },
"black star" => { 201005011000 => '1' }
cached_counts CF
"back in black" => { 'cached_count' => 2, 'counted_until' => 201005011931 },
"black album" => { 'cached_count' => 1, 'counted_until' => 201005010600 }
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@pombredanne
pombredanne / .gitignore
Created August 14, 2012 05:17 — forked from kiorky/.gitignore
test
bin
develop-eggs
.installed.cfg
.mr.developer.cfg
*.egg-info
*.pyc
parts
@pombredanne
pombredanne / gist:3353096
Created August 14, 2012 21:14
Compile daemontools on cygwin
#!/bin/sh -e
# Compile D. J. Bernstein's daemontools on Cygwin
# Need curl, tar, sed, make, patch, gcc installed
curl -LO http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
sha1sum daemontools-0.76.tar.gz | grep 70a1be67e7dbe0192a887905846acc99ad5ce5b7
tar xf daemontools-0.76.tar.gz
rm -f daemontools-0.76.tar.gz
cd admin/daemontools-0.76
@pombredanne
pombredanne / bookmarklet.js
Created August 30, 2012 17:08 — forked from orientalperil/bookmarklet.js
jQuery Bookmarklet Template w/ Async Loading
// You create your bookmarklet by instantiating
// a new Bookmarklet function, then pass in the options like so.
// This example checks to see if the var is already defined, and makes
// sure not to overwrite it. This could happen if the user clicks on
// the bookmarklet more than once.
var MyBookmarklet = MyBookmarklet || new Bookmarklet({
// debug: true, // use debug to bust the cache on your resources
css: ['/my/style.css'],
js: [],
from django.db import models
import uuid
class UUIDField(models.CharField):
"""
A field which stores a UUID value in hex format. This may also have
the Boolean attribute 'auto' which will set the value on initial save to a
new UUID value (calculated using the UUID1 method). Note that while all
UUIDs are expected to be unique we enforce this with a DB constraint.
from deployment.cuisine import *
from fabric.api import *
from fabric.context_managers import *
from fabric.utils import puts
from fabric.colors import red, green
import simplejson
import os
import os
import socket
import urllib
import urlparse
import cherrypy
# Django settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
# Celery loader