Skip to content

Instantly share code, notes, and snippets.

@HowardMei
HowardMei / web2faction.sh
Created April 2, 2012 06:51
install web2py with nginx and uwsgi on webfaction
#!/bin/sh
# modified from: http://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgi
# * bumped the versions of nginx, uwsgi and web2py
echo 'Install script for nginx-1.1.18 , uwsgi-1.1.2 and web2py-1.99.7 (latest stable)'
echo 'If you wish to create cronjobs comment out the last lines of this script'
# port betweet nginx and uwsgi, find a free port to use
nginx_uwsgi_port=9111
@HowardMei
HowardMei / gmaildomain.py
Created April 3, 2012 02:28 — forked from dstevensio/gmaildomain.py
Python Script To Add DNS Overrides For WebFaction Hosted Domains to use Google Apps Mail
'''
Run this script either by doing:
python gmaildomain.py
And you will be prompted for details, or you can save time by doing:
python gmaildomain.py WEBFACTION_USERNAME_HERE DOMAIN_TO_USE_GMAIL_FOR_HERE_WITHOUT_WWW
And you will only be prompted for your password.
@HowardMei
HowardMei / pytimer.py
Created April 26, 2012 03:26
A simple sematic timestring parser with handy timer functions
#! /usr/bin/env python
## -*- coding: utf-8 -*-
################################################################
## Name: pytimer v0.0.1 Dec 12, 2011
## Notes: A sematic time string parser with handy timer functions
## Author: Howard Mei
## Email: howardleomei@gmail.com
## License: MIT, http://www.opensource.org/licenses/mit-license.php
################################################################
@HowardMei
HowardMei / django_interface.py
Created May 7, 2012 03:47 — forked from niwinz/django_interface.py
Django websockets with tornado, gevent and zeromq
# -*- coding: utf-8 -*-
from gevent import monkey; monkey.patch_all()
import gevent
from gevent_zeromq import zmq
class WebSocketHandler(object):
def __init__(self, _id, in_queue, socket):
@HowardMei
HowardMei / nginx.conf
Created July 26, 2012 07:35 — forked from justincormack/nginx.conf
Using Lua and Nginx to proxy Amazon web services example
# example location parts of nginx.conf
# add your own AWS keys, server lines etc, and set your aws domains, paths
http {
# you will need the luacrypto in the cpath, download from http://luacrypto.luaforge.net/
lua_package_cpath "/home/justin/lua/luacrypto-0.2.0/src/l?.so.0.2.0;;";
server {
listen 80;
@HowardMei
HowardMei / install_profile.php
Created October 30, 2012 14:51
New Wordpress Install Profile
<?php
//$base_dir = '/home/username/www/wordpress';
//chdir($base_dir);
define( 'WP_SITEURL', 'http://localhost/wordpress' );
define( 'WP_INSTALLING', true );
require_once 'wp-load.php';
require_once 'wp-admin/includes/upgrade.php';
@HowardMei
HowardMei / wp-config-multienv.php
Created October 30, 2012 14:53
wordpress config for multiple environments
<?php
/**
* The base configurations of the WordPress.
*
* This file is a custom version of the wp-config file to help
* with setting it up for multiple environments. Inspired by
* Leevi Grahams ExpressionEngine Config Bootstrap
* (http://ee-garage.com/nsm-config-bootstrap)
*
* @package WordPress
@HowardMei
HowardMei / gist:4223859
Created December 6, 2012 11:37
Possible way to separate Model from DB
In https://github.com/joshmarshall/norm, Josh tries to separate business model from persistent db backend.
In https://github.com/j2labs/dictshield and https://github.com/j2labs/schematics, j2labs try to unify the way to represent business data model.
Possible solution for RDS that http://code.google.com/p/appengine-ndb-experiment/ does for GAE ?
@HowardMei
HowardMei / gist:4223942
Created December 6, 2012 11:58
A collection of rule engine or dsl policy engine
Simplest:
https://github.com/oblique63/ChainableLogic Chain logic
https://github.com/hynek/first Get the first meaningful value
https://github.com/xerox91/LogicE A pure fact truth logic
Advanced:
https://github.com/nemonik/Intellect DSL rules/policies engine
https://github.com/knipknap/SpiffWorkflow Workflow patterns
Filesystem:
@HowardMei
HowardMei / gist:4223999
Created December 6, 2012 12:10
Python file match content search diff patch collection
Grep like file search: https://bitbucket.org/eliben/pss/
Google diff match patch: https://bitbucket.org/spookylukey/diff-match-patch/overview
Mercurial mdiff match mpatch merge: http://selenic.com/hg