Skip to content

Instantly share code, notes, and snippets.

View jdmaturen's full-sized avatar

jd jdmaturen

View GitHub Profile
@jdmaturen
jdmaturen / Gorillaz - Plastic Beach (2010).sh
Created March 1, 2010 17:06
Gorillaz - Plastic Beach (2010)
#!/bin/bash
wget http://del.interoute.com/?id=aa1fa024-ae1d-4285-923e-3ccfc6385200&delivery=download
wget http://del.interoute.com/?id=0be7e9f6-e572-411c-81cf-5b59de45336d&delivery=download
wget http://del.interoute.com/?id=3b30d50f-850b-495a-acfb-8d6d7d6a3e57&delivery=download
wget http://del.interoute.com/?id=23cc3dcc-4b11-4809-8d95-8cc07f1b5cae&delivery=download
wget http://del.interoute.com/?id=bd58c55a-136f-46c2-abf6-51c05ecaa780&delivery=download
wget http://del.interoute.com/?id=0d5ba0c2-bdd2-4a72-b654-55053e125527&delivery=download
wget http://del.interoute.com/?id=ad9e99c7-e5ad-49bc-8e12-0230db2807be&delivery=download
wget http://del.interoute.com/?id=08227202-0d13-4020-b99e-8b9c6741b656&delivery=download
wget http://del.interoute.com/?id=ca16419d-5f81-4d12-a998-f87a08e72971&delivery=download
# In-memory Cassandra-ish thingy... useful for unit tests. Maybe useful for other
# stuff too? No support for SuperColumns, but that should be easy enough to add.
import bisect
import copy
from cassandra.ttypes import NotFoundException, Column, ColumnPath, ColumnOrSuperColumn
class SSTable(object):
(jd@XXX) /home/jd/shovel> time ./shovel.py jd_test
got 901 messages
real 0m1.617s
user 0m0.558s
sys 0m0.044s
import multiprocessing
import sys
from multiprocessing import JoinableQueue
from multiprocessing import Pipe
from multiprocessing import Queue
from multiprocessing import Process
from pylibmc import Client
from time import sleep
@jdmaturen
jdmaturen / gist:530803
Created August 17, 2010 16:52
Cassandra 0.7 thrift example. CC license.
<?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() {
--- 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'
<?php
namespace app;
include '../config/bootstrap.php';
use \Exception;
use \Http404;
@jdmaturen
jdmaturen / sleep.php
Created January 14, 2011 08:07
ms timeout in tornado
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)
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)
from gevent import monkey; monkey.patch_socket()
import gevent
import httplib2
from gevent import http
from time import time