Skip to content

Instantly share code, notes, and snippets.

@jeanphix
jeanphix / fabfile.py
Created February 23, 2013 16:50
django deployment from git remotes.
# -*- coding: utf-8 -*-
from fabric.state import env
from fabric.api import cd, local, run, abort, task
from fabric.context_managers import prefix
def worktree(cmd):
with prefix('source /usr/bin/virtualenvwrapper.sh'):
with cd(env.repo_path):
with prefix('cd `git config --get core.worktree`'):
@jeanphix
jeanphix / gist:53af6d5912fd6cc1f22f
Created June 17, 2015 06:20
alembic check_revision
# -*- coding: utf-8 -*-
import os
import re
import subprocess
from copy import copy
from difflib import unified_diff
from sqlalchemy import create_engine
create extension if not exists "unaccent";
create or replace function slugify(name text)
returns text as $$
begin
return trim(
regexp_replace(
unaccent(lower(name)),
'[^0-9a-z]+',