Skip to content

Instantly share code, notes, and snippets.

View lxneng's full-sized avatar
🎯
Focusing

Eric Luo lxneng

🎯
Focusing
View GitHub Profile
@mdellavo
mdellavo / pyramid-gevent-websocket.py
Created February 3, 2012 05:10
A Pyramid GEvent WebSocket Demo
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
@dahlia
dahlia / hstore.py
Created February 18, 2012 14:58
PostgreSQL hstore + SQLAlchemy
""":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::
@globerunnerseo
globerunnerseo / my.cnf
Created April 6, 2012 16:25 — forked from thattommyhall/my.cnf
Suggested my.cnf
[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
@rduplain
rduplain / app.py
Created April 10, 2012 15:58
Flask: serving static file from a separate domain
# 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',
@olistik
olistik / gist:2627011
Last active August 12, 2021 06:39
Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)

Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)

Basic pre-requisites

  • Some utilities:
sudo apt-get install vim tmux git curl
  • Copy/paste from the command line:
@mlhamel
mlhamel / gist:2726808
Created May 18, 2012 18:11
nodejs buildout config
[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
@tmcallister
tmcallister / faye.rb
Created May 23, 2012 23:52
Faye with nginx config
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
@jboner
jboner / latency.txt
Last active May 9, 2025 06:12
Latency Numbers Every Programmer Should Know
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
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!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>
@mnazim
mnazim / learning_resources.markdown
Last active March 18, 2016 09:22
Open Source Web Development Learning Resources For Beginners and Freshers

Open Source Web Development Learning Resources For Beginners and Freshers

This place is a dump for learning online/offline resources. Aim is to create a curated list of resources.

Tools and Infrastructure

Basic Linux