Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)
- Some utilities:
sudo apt-get install vim tmux git curl
- Copy/paste from the command line:
from gevent import monkey, Greenlet | |
from gevent.queue import Queue, Empty | |
from gevent.pywsgi import WSGIServer | |
import gevent | |
monkey.patch_all() | |
from geventwebsocket.handler import WebSocketHandler | |
from pyramid.config import Configurator | |
from pyramid.view import view_config |
""":mod:`hstore` --- Using PostgreSQL hstore with SQLAlchemy | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
.. note:: | |
I released it under Public Domain. Feel free to use! | |
It provides :class:`Hstore` type which makes you to store Python | |
dictionaries into hstore columns in PostgreSQL. For example:: |
[client] | |
default-character-set = utf8 | |
socket = /tmp/mysql.sock | |
[mysqld] | |
#skip-grant-tables | |
max_sp_recursion_depth = 255 | |
socket = /tmp/mysql.sock | |
tmpdir = /opt/tmp |
# http://flask.pocoo.org/mailinglist/archive/2012/4/10/serving-static-file-from-a-separate-domain-in-production/ | |
from flask import Flask, url_for | |
# Uncomment to set server name. | |
# SERVER_NAME = 'mianos.com' | |
app = Flask(__name__, static_folder=None) | |
app.config.from_object(__name__) | |
app.add_url_rule('/<path:filename>', endpoint='static', |
sudo apt-get install vim tmux git curl
[buildout] | |
parts = nodejs nodejs-bin | |
versions = versions | |
[versions] | |
mongodb = 1.8.1 | |
[nodejs] | |
recipe = zc.recipe.cmmi | |
url = http://nodejs.org/dist/v0.6.16/node-v0.6.16.tar.gz |
FAYE_TOKEN = 'secretToken' | |
if defined? Rails | |
if Rails.env == 'development' | |
FAYE_URI = "http://#{APP_CONFIG[:nameremoved_service][:host]}:9292/faye" | |
else | |
FAYE_URI = "https://#{APP_CONFIG[:nameremoved_service][:host]}/faye" | |
end |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
<!doctype html> | |
<title>Site Maintenance</title> | |
<style> | |
body { text-align: center; padding: 150px; } | |
h1 { font-size: 50px; } | |
body { font: 20px Helvetica, sans-serif; color: #333; } | |
article { display: block; text-align: left; width: 650px; margin: 0 auto; } | |
a { color: #dc8100; text-decoration: none; } | |
a:hover { color: #333; text-decoration: none; } | |
</style> |