Skip to content

Instantly share code, notes, and snippets.

Follow these steps to install graphite on OS X Lion.

Prerequisites

  • Python 2.7
  • Brew
  • Git

Install dependencies

Install Cairo

Follow these steps to install graphite on OS X Lion.

Prerequisites

  • Python 2.7
  • Brew
  • Git

Install dependencies

Install Cairo

Follow these steps to install graphite on OS X Lion.

Prerequisites

  • Python 2.7
  • Brew
  • Git

Install dependencies

Install Cairo

import gevent
from thrift.server.TServer import TServer
# XXX Hackish, but should be safe: monkey patch gevent socket support into
# Thrift. Overall I think this is cleaner than reimplementing all of TSocket.
from thrift.transport import TSocket; TSocket.socket = gevent.socket
from thrift.transport.TTransport import TTransportException
class TGEventServer(TServer):
"""Gevent socket server."""
@fabware
fabware / download_video.sh
Created July 22, 2012 02:48 — forked from ftao/download_video.sh
download pycon2012 videos
#!/bin/sh
wget https://github.com/rg3/youtube-dl/zipball/master -O youtube-dl.zip
unzip youtube-dl.zip
cd rg3-youtube-dl-ceba827/
python youtube-dl --batch-file ../pycon2012_video_urls.txt
@fabware
fabware / zerologger.py
Created July 15, 2012 14:25 — forked from gwik/zerologger.py
Python logger ZeroMQ, Gevent, CouchDB
# encoding: utf-8
"""
A python logging Handler that use ZeroMQ (ØMQ).
+------+ +------+ +-------+
| app1 | | app2 | | app X |
+------+ +------+ +-------+
| PUSH | PUSH | PUSH
| | |
@fabware
fabware / iprange.cc
Created September 21, 2011 23:08 — forked from chenshuo/iprange.cc
从一组 IP range --> value 的数据中查找单个 IP
#include <assert.h>
#include <stdint.h>
#include <algorithm>
#include <vector>
using namespace std;
struct IPrange
{
@fabware
fabware / application.js
Created June 8, 2011 03:23
socket.io application and haproxy configuration
var express = require('express');
var redis = require('redis');
const serverType = process.argv[2];
const serverHost = process.argv[3];
const serverPort = parseInt(process.argv[4]);
const redisPort = 6379;
const redisHost = '127.0.0.1';
Setup
=====
[stunnel acccept port 443 connect 8443]
||
[haproxy
* accept port 80
default: connect 8080 (nginx)
host: 'push.*' => connect 8090 (node)
* accept port 8443