This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from math import exp | |
from random import random | |
from time import sleep | |
from time import time | |
from uuid import uuid1 | |
from redis.exceptions import WatchError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""http://en.wikipedia.org/wiki/Reservoir_sampling | |
""" | |
import random | |
import struct | |
class RedisReservoirSample(object): | |
def __init__(self, redis, n, fmt='>i'): | |
""" | |
n is the sample size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import gevent | |
from gevent.queue import Queue | |
from thrift.server.TServer import TServer | |
from thrift.transport.TTransport import TTransportException | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gevent | |
from gevent import monkey | |
monkey.patch_socket() | |
import hashlib | |
import os | |
import redis | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gevent import monkey; monkey.patch_socket() | |
import gevent | |
import httplib2 | |
from gevent import http | |
from time import time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gevent import monkey; monkey.patch_socket() | |
import gevent | |
import httplib2 | |
from gevent import queue | |
from time import time | |
def worker(q): | |
h = httplib2.Http(timeout=0.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tornado/httpclient.py b/tornado/httpclient.py | |
index 25d07ae..89e1fd4 100644 | |
--- a/tornado/httpclient.py | |
+++ b/tornado/httpclient.py | |
@@ -536,7 +536,8 @@ def _curl_setup_request(curl, request, buffer, headers): | |
curl.setopt(pycurl.FOLLOWLOCATION, request.follow_redirects) | |
curl.setopt(pycurl.MAXREDIRS, request.max_redirects) | |
curl.setopt(pycurl.CONNECTTIMEOUT, int(request.connect_timeout)) | |
- curl.setopt(pycurl.TIMEOUT, int(request.request_timeout)) | |
+ curl.setopt(pycurl.NOSIGNAL, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app; | |
include '../config/bootstrap.php'; | |
use \Exception; | |
use \Http404; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/Library/Formula/membase.rb | |
+++ b/Library/Formula/membase.rb | |
@@ -1,9 +1,9 @@ | |
require 'formula' | |
class Membase < Formula | |
- url 'http://membase.org/downloads/membase_1.6.0beta2-18-g638fc06_src.tar.gz' | |
+ url 'http://membase.org/downloads/membase_1.6.0beta3_src.tar.gz' | |
homepage 'http://membase.org' | |
- md5 'b0b2a5d909cf3d2e20db07c4d12259a0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$GLOBALS['THRIFT_ROOT'] = '/path/to/thrift/'; | |
require_once $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/Cassandra.php'; | |
require_once $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/cassandra_types.php'; | |
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php'; | |
require_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php'; | |
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php'; | |
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php'; | |
function microsecond_timestamp() { |