Skip to content

Instantly share code, notes, and snippets.

View string replace in a file using sed in python
import subprocess
def string_replace_in_file(file_name_with_path, replacements=[]):
'''sed runs all the replacements in a single pass'''
sed_cmd = ['sed', '-i']
for l in replacements:
find_str = l['find'].replace('/', '\/')
replace_str = l['replace'].replace('/', '\/')
sed_expr = "-e s/%s/%s/g" % (find_str, replace_str)
jambu /
Created Jul 11, 2012 — forked from mikeyk/
A redis backend for Django Sessions, tested on Django 1.3+
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(
View gist:2364905
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
jambu / gmail-scrollbars.css
Created Mar 9, 2012 — forked from Cifro/gmail-scrollbars.css
New Gmail like scrollbars for webkit browsers
View gmail-scrollbars.css
/* Gmail style scrollbar */
::-webkit-scrollbar {
width: 12px
::-webkit-scrollbar-thumb {
border-width: 1px 1px 1px 2px
::-webkit-scrollbar-track {
border-width: 0
You can’t perform that action at this time.