Install Python
$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7
Symlinks...
| " Vim syntax file | |
| " Language: LESS Cascading Style Sheets | |
| " Maintainer: Leaf Corcoran <leafot@gmail.com> | |
| " Modifier: Bryan J Swift <bryan@bryanjswift.com> | |
| " URL: http://leafo.net/lessphp/vim/less.vim | |
| " URL: http://gist.github.com/161047 | |
| " Last Change: 2009 August 4 | |
| " LESS by Leaf Corcoran | |
| " CSS2 by Nikolai Weibull | |
| " Full CSS2, HTML4 support by Yeti |
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # 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. |
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| """ | |
| Usage: | |
| fab deploy:appname | |
| """ | |
| from fabric.api import env, run, cd, local, put | |
| env.hosts = ['myserver.com'] | |
| env.user = 'eric' |
| import pymongo | |
| from pymongo import Connection | |
| from pymongo.dbref import DBRef | |
| from pymongo.database import Database | |
| # connect | |
| connection = Connection() | |
| db = Database(connection, "things") | |
| # clean up |
| worker_processes 2; | |
| error_log /var/log/nginx/error.log; | |
| pid /var/run/nginx.pid; | |
| events { | |
| worker_connections 1024; | |
| use epoll; | |
| } |
| #!/usr/bin/env python | |
| # | |
| # 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 | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
Install Python
$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7
Symlinks...
| class Application(tornado.web.Application): | |
| def __init__(self): | |
| tornado.web.Application.__init__(self, handlers, **settings) | |
| self.db_session = db_session | |
| self.redis = redis.StrictRedis() | |
| self.session_store = RedisSessionStore(self.redis) | |
| class BaseHandler(tornado.web.RequestHandler): |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # zipdb.py | |
| # Use a zipfile store a dict like k-v database. | |
| # Known bug: duplicate key(filenames) allowed | |
| # | |
| # Copyright 2012 mayli <mayli.he@gmail.com> | |
| # |