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
# An example of the below | |
virtualenv "/home/dvcsmirrors/hg" do | |
owner "root" | |
group "dvcsmirrors" | |
mode 0775 | |
packages "Mercurial" => "1.6.3", | |
"hgsubversion" => "1.1.2" | |
end |
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
// helper function that goes inside your socket connection | |
client.connectSession = function(fn) { | |
var cookie = client.request.headers.cookie; | |
var sid = unescape(cookie.match(/connect\.sid=([^;]+)/)[1]); | |
redis.get(sid, function(err, data) { | |
fn(err, JSON.parse(data)); | |
}); | |
}; | |
// usage |
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
# | |
# Cookbook Name:: atari | |
# Recipe:: db_server | |
# | |
# Copyright 2010, Atari | |
# | |
# All rights reserved | |
# | |
include_recipe "postgresql::server" |
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/sh | |
### BEGIN INIT INFO | |
# Provides: gunicorn_django | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Gunicorn WSGI server for django | |
# Description: This script starts a gunicorn instance for each django instance | |
### END INIT INFO |
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
/** | |
* Binds a method to an object, so "this" inside the method | |
* refers to that object when it is called. | |
* @param method | |
* A reference to the function to call | |
* @param obj | |
* The object to bind to | |
* @param options | |
* Optional. If supplied, binds these options and passes | |
* them during invocation. |
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
#!/usr/bin/env python | |
""" | |
fabfile.py | |
Copyright (c) 2011 Giovanni Collazo | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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.contrib.sessions.backends.base import SessionBase, CreateError | |
from django.conf import settings | |
from django.utils.encoding import force_unicode | |
import redis | |
class SessionStore(SessionBase): | |
""" Redis store for sessions""" | |
def __init__(self, session_key=None): | |
self.redis = redis.Redis( |
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
# references.rb has moved to https://github.com/olov/jekyll-references |
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 Image | |
import cStringIO | |
from django.core.files.base import ContentFile | |
from django.db.models import ImageField | |
from django.db.models.fields.files import ImageFieldFile | |
class JPEGImageFieldFile(ImageFieldFile): | |
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
# originally from https://github.com/martinrusev/django-redis-sessions | |
# but use json, not pickle | |
import json | |
import pickle | |
import time | |
from redis import Redis | |
from django.utils.encoding import force_unicode | |
from django.contrib.sessions.backends.base import SessionBase, CreateError | |
from django.conf import settings |
OlderNewer