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 fabric.api import env | |
env.use_ssh_config = True | |
env.forward_agent = True | |
env.roledefs = { | |
# key # hostname from config | |
'foo': ['foo.production'], | |
} |
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
""" | |
Distributor ID: Ubuntu | |
Description: Ubuntu 10.04 LTS | |
Release: 10.04 | |
Codename: lucid | |
Author: Adelein Rodriguez, adeleinr@gmail.com | |
Note: This is an adaptation from a fabric script presented here: | |
http://morethanseven.net/2009/07/27/fabric-django-git-apache-mod_wsgi-virtualenv-and-p.html | |
Summary: This script: |
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
{ | |
"directory": "src/_lib", | |
"json": "bower.json" | |
} |
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 ThriftConnection(object): | |
def __init__(self, service, host, port): | |
socket = TSocket.TSocket(host, port) | |
self.transport = TTransport.TFramedTransport(socket) | |
protocol = TBinaryProtocolAccelerated(self.transport) | |
self.client = service.Client(protocol) | |
self.transport.open() | |
self.open_time = time.time() | |
self.access_time = self.open_time | |
self.pid = os.getpid() |
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 unittest | |
import functools | |
def check(sub, sup): | |
try: | |
if len(sub) == 1 and sup.index(sub[0]) >= 0: | |
return True | |
return check(sub[1:], sup[sup.index(sub[0]) + 1:]) | |
except: | |
return False |
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 flask import Flask, request, session, g, redirect, url_for | |
from flask import abort, render_template, flash | |
app = Flask(__name__) | |
app.config.from_object(__name__) | |
hosts = { | |
'b': "https://code.google.com/p/android/issues/" | |
's': "https://android.googlesource.com/", | |
'r': "https://android-review.googlesource.com/", |
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
# models.py | |
from django.db import models | |
class BusinessLog(models.Model): | |
STATUS = (('ING', 'Ongoing'), | |
('DONE', 'Done')) | |
status = models.CharField(choices=STATUS, default='ING') |
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
import re | |
import simplejson | |
from django.http import HttpResponse | |
from django.conf import settings | |
class JSONResponse(HttpResponse): | |
def __init__(self, request, data): | |
indent = 2 if settings.DEBUG else None |
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
#-*-coding:utf-8-*- | |
import re | |
import unicodedata | |
from django.utils.encoding import smart_unicode | |
# Extra characters outside of alphanumerics that we'll allow. | |
SLUG_OK = '-_~' | |
OlderNewer