Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
# -*- coding: utf-8 -*- | |
from uuid import uuid4 | |
from datetime import timedelta | |
from couchbase import Couchbase | |
from couchbase import FMT_PICKLE | |
from couchbase.exceptions import NotFoundError |
# wordpress over fastcgi | |
server { | |
listen 81; | |
server_name _; | |
root /mnt/apps/airpair-blog/current; | |
index index.html index.php /index.php; | |
# restricting all dot files | |
location ~ /\. { return 403; } |
/** | |
* Copyright 2012 Akseli Palén. | |
* Created 2012-07-15. | |
* Licensed under the MIT license. | |
* | |
* <license> | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files | |
* (the "Software"), to deal in the Software without restriction, | |
* including without limitation the rights to use, copy, modify, merge, |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
from flask import Flask | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext import admin, wtf | |
from flask.ext.admin.contrib import sqlamodel | |
app = Flask(__name__) | |
app.config['SECRET_KEY'] = '123456790' | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.sqlite' | |
db = SQLAlchemy(app) |
==> Downloading http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2 | |
Already downloaded: /Library/Caches/Homebrew/python-2.7.4.tar.bz2 | |
tar xf /Library/Caches/Homebrew/python-2.7.4.tar.bz2 | |
==> ./configure --prefix=/usr/local/Cellar/python/2.7.4 --enable-ipv6 --datarootdir=/usr/local/Cellar/python/2.7.4/share --datadir=/usr/local/Cellar/python/2.7.4/share --enable-framework=/usr/local/Cellar/python/2.7.4/Frameworks --without-gcc CFLAGS=-I/usr/local/include -I/usr/local/opt/sqlite/include LDFLAGS=-L/usr/local/lib -L/usr/local/opt/sqlite/lib MACOSX_DEPLOYMENT_TARGET=10.7 | |
./configure --prefix=/usr/local/Cellar/python/2.7.4 --enable-ipv6 --datarootdir=/usr/local/Cellar/python/2.7.4/share --datadir=/usr/local/Cellar/python/2.7.4/share --enable-framework=/usr/local/Cellar/python/2.7.4/Frameworks --without-gcc CFLAGS=-I/usr/local/include -I/usr/local/opt/sqlite/include LDFLAGS=-L/usr/local/lib -L/usr/local/opt/sqlite/lib MACOSX_DEPLOYMENT_TARGET=10.7 | |
checking build system type... x86_64-apple-darwin11.4.2 | |
check |
HOMEBREW_VERSION: 0.9.4 | |
ORIGIN: [email protected]:mxcl/homebrew.git | |
HEAD: c472dbeabb3f56e8a9a283511f8addfd55210512 | |
HOMEBREW_PREFIX: /usr/local | |
HOMEBREW_CELLAR: /usr/local/Cellar | |
CPU: dual-core 64-bit core2 | |
OS X: 10.7.5-i386 | |
CLT: 4.6.0.0.1.1362189000 | |
LLVM-GCC: build 2336 | |
Clang: 4.2 build 425 |
CREATE OR REPLACE FUNCTION name(arg datatype) | |
RETURNS TABLE(column datatype) AS | |
$$ | |
BEGIN | |
RETURN QUERY EXECUTE 'SELECT * FROM table WHERE column = $1' USING arg; | |
END; | |
$$ | |
LANGUAGE plpgsql; |
#!/bin/bash | |
# Starts, stops, and restarts Railo | |
RAILO_DIR="/opt/railo" | |
JAVA_OPTS_MAIN="-DSTOP.PORT=8887 -DSTOP.KEY=railo -jar" | |
JAVA_OPTS_AGENT="-javaagent:lib/ext/railo-inst.jar" | |
JAVA_OPTS_MEM="-Xms256M -Xmx512M" | |
JAVA_OPTS_JAR="start.jar" |
import logging | |
import redis # http://pypi.python.org/pypi/redis | |
class RedisHandler(logging.Handler): | |
def __init__(self, lname, conn, *args, **kwargs): | |
logging.Handler.__init__(self, *args, **kwargs) | |
self.lname = lname | |
self.channel = lname + ":chan" | |
self.redis_conn = conn |