Skip to content

Instantly share code, notes, and snippets.

View lxneng's full-sized avatar
🎯
Focusing

Eric Luo lxneng

🎯
Focusing
View GitHub Profile
@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
@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:
@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',
@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
@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::
@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
@jdan
jdan / listall.py
Created January 13, 2012 03:19
A python script to recursively list all files in a given directory, newline separated
#!/usr/bin/python
import os
import sys
def listdir(d):
if not os.path.isdir(d):
print d
else:
for item in os.listdir(d):
listdir((d + '/' + item) if d != '/' else '/' + item)
@lucasdavila
lucasdavila / install_munin_and_passenger_plugins.sh
Created December 21, 2011 16:36
Install Munin and Passenger Plugins
# to use this gist execute: $ rm -f 1506695 && wget https://raw.github.com/gist/1506695 && sh 1506695
# refs to http://www.alfajango.com/blog/how-to-monitor-your-railspassenger-app-with-munin/
echo "Installing munin..."
sudo apt-get install munin munin-node -y
echo ;
echo "Removing previous links for passenger_status and passenger_memory_stats..."
sudo rm /etc/munin/plugins/passenger_memory_stats
sudo rm /etc/munin/plugins/passenger_status
@dennisreimann
dennisreimann / manual_passenger_nginx.sh
Created December 6, 2011 13:57
Manual Nginx installation via Passenger
# download and untar nginx
wget -O /tmp/nginx.tar.gz http://www.nginx.org/download/nginx-1.0.11.tar.gz
tar xzvf /tmp/nginx.tar.gz
rm /tmp/nginx.tar.gz
# download and untar extra modules
wget -O /tmp/nginx-echo-module.tar.gz https://github.com/agentzh/echo-nginx-module/tarball/v0.38rc1
tar xzvf /tmp/nginx-echo-module.tar.gz
rm /tmp/nginx-echo-module.tar.gz
@afternoon
afternoon / git-slim.py
Created December 5, 2011 14:42
Remove large objects from a git repository
#!/usr/bin/python
#
# git-slim
#
# Remove big files from git repo history.
#
# Requires GitPython (https://github.com/gitpython-developers/GitPython)
#
# References:
# - http://help.github.com/remove-sensitive-data/