Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Wes Mason 1stvamp

:shipit:
View GitHub Profile
View wsgi_extract.py
# standard wsgi middleware
def some_wsgi_middleware(app):
def middleware(environ, start_response)
def custom_start_response(status, headers, exc_info):
# they get overwritten here from func args
custom_start_response._status = status
custom_start_response._headers = headers
response = app(environ, custom_start_response)
View rfc-snappy-ports.md

The current situation

The current spec states that ports are a top level entry in the package.yaml as

    name: go-example-webserver
    vendor: Alexander Sack <asac@canonical.com>
    architecture: amd64
    icon: meta/go.svg
    version: 1.0.1
View fabfile.py
from fabric.api import env, task, run, sudo, cd, local
from fabric.decorators import with_settings
from fabric.operations import put
env.user = 'ec2-user'
env.hosts = [
'ec2-your-address-1.us-west-2.compute.amazonaws.com',
'ec2-your-address-2.us-west-2.compute.amazonaws.com',
'ec2-your-address-3.us-west-2.compute.amazonaws.com',
'ec2-your-address-4.us-west-2.compute.amazonaws.com',
@1stvamp
1stvamp / francois.py
Created May 8, 2012
Super simple tweet fetcher using python.
View francois.py
import json
import urllib2
username = 'ignorethecrane'
url = 'https://twitter.com/statuses/user_timeline/%s.json' % (username,)
u = urllib2.urlopen(url)
tweets = json.loads(u.read())
@1stvamp
1stvamp / git_branch_and_version_in_prompt.sh
Created Oct 13, 2011 — forked from bassdread/Version Display
Display git branch and version in your prompt
View git_branch_and_version_in_prompt.sh
# Show current git branch or SVN subfolder in prompt.
GREEN="\[\033[0;32m\]"
LIGHT_GREEN="\[\033[1;32m\]"
GRAY="\[\033[1;30m\]"
LIGHT_BLUE="\[\033[1;34m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_OFF="\[\e[0m\]"
LAST_GIT_DIR="!"
function prompt_func() {
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
View phing-upgrade-wordpress
<target name="wordpress.upgrade">
<property name="tmp" value="/tmp" />
<property name="src" value="${tmp}/wordpress" />
<delete dir="${src}" includeemptydirs="true" failonerror="true" />
<exec dir="${tmp}" command="curl -s http://wordpress.org/latest.tar.gz | tar -xz" />
<delete dir="wp-admin" includeemptydirs="true" failonerror="true" />
<delete dir="wp-includes" includeemptydirs="true" failonerror="true" />
<move file="wp-config.php" tofile="wp-config.php.bak" overwrite="true"/>