Skip to content
View default.conf
server {
listen 80;
server_name blog;
root /var/www/blog;
location /static/ {
alias /var/www/blog/static/;
expires 30d;
access_log off;
View blog.ini
# Variables
base = /var/www/blog
app = simple
# Generic Config
plugins = http,python
home = %(base)/venv
pythonpath = %(base)
socket = /var/www/run/%n.sock
module = %(app)
View uwsgi.conf
description "uWSGI"
start on runlevel [2345]
stop on runlevel [06]
env UWSGI=/usr/bin/uwsgi
env LOGTO=/var/log/uwsgi/emperor.log
exec $UWSGI --master --emperor /etc/uwsgi/apps-enabled --die-on-term --uid nginx --gid nginx --logto $LOGTO
# Shell script to automatically configure a new Flask, nginx and uWSGI based blog
# on an Amazon EC2 instance.
# See for more information!
# If you are forking this for your own custom configuration script, see the following other gists:

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

from bitarray import bitarray
import mmh3
class BloomFilter:
def __init__(self, size, hash_count):
self.size = size
self.hash_count = hash_count
self.bit_array = bitarray(size)
View bootstrap-scrollspy-horizontal.js
/* =============================================================
* bootstrap-scrollspy.js v2.0.1
* =============================================================
* Copyright 2012 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

Setup vagrant boxes

Since released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.

However, the guys at didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.


#!/usr/bin/env python
Synchronise block devices over the network
Copyright 2006-2008 Justin Azoff <>
Copyright 2011 Robert Coup <>
License: GPL
Getting started:
View gist:2027501
def writer = new FileWriter('sample2.xml')
// Define 2 tables
def tables =[]
def dept = new Table(tableName:'departments')
dept.columns << new Column(name:'id', type:'number(4,0)', nullable:false)
dept.columns << new Column(name:'dname', type:'varchar2(14)', remarks:'Department name')
tables << dept
def emp = new Table(tableName:'employees', remarks:'All employees known in HR system')
Something went wrong with that request. Please try again.