Skip to content

Instantly share code, notes, and snippets.

JoshTGreenwood / gist:443253f42fb80455792f
Created Dec 1, 2015
Automatically add magit cloned repos to the projectile project list
View gist:443253f42fb80455792f
(defun add-project-to-projectile-known-projects (_ directory)
(projectile-add-known-project directory))
(advice-add 'magit-clone :after 'add-project-to-projectile-known-projects)
wolever /
Last active Apr 6, 2021
Parse and escape a query string so it's safe to use with Postgres' `to_tsquery(…)`
import re
from import assert_equal
from nose_parameterized import parameterized
from tsquery_escape import tsquery_escape
("1 OR 2", "1 | 2"),
("(1) 2", "( 1 ) & 2"),
("&", "'&':*"),
wichert / form-example.html
Created Nov 30, 2012
WTForms and pyramid integration
View form-example.html
<form id="loginForm" method="post" action="${request.route_url('login')}">
<input type="hidden" name="csrf_token" value="${request.session.get_csrf_token()}"/>
<fieldset class="concise">
<metal:field tal:define="name 'came_from'" use-macro="snippets['hidden']"/>
<metal:field tal:define="name 'login'" use-macro="snippets['text']"/>
<metal:field tal:define="name 'password'" use-macro="snippets['password']"/>
<div class="buttonBar">
<button type="submit" class="default" i18n:translate="">Login</button>
dewski /
Created Jan 20, 2012 — forked from jasonroelofs/
Turn an EC2 micro instance into a StatsD/Graphite server
ec2-authorize default -p 2003
View gist:814432
from oauth2 import Error
from django.utils.translation import ugettext as _
from tastypie.authentication import Authentication
from oauth_provider.utils import initialize_server_request, send_oauth_error, get_oauth_request
from oauth_provider.consts import OAUTH_PARAMETERS_NAMES
from import store, InvalidTokenError
kylefritz /
Created Oct 18, 2010
publish a message to Amazon SNS using python or ruby
from time import strftime,gmtime,time
import urllib2
import hmac
import hashlib
import base64
import string
def publishAmazonSnsMsg(Subject,TopicArn,Message,AWSAccessKeyId,privatekey):
amzsnshost = ''
danmackinlay /
Created Aug 27, 2009
an init.d script for supervisord
#! /bin/sh
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.