Skip to content

Instantly share code, notes, and snippets.

View lukecampbell's full-sized avatar

Luke Campbell lukecampbell

View GitHub Profile
@lukecampbell
lukecampbell / load_datasets.py
Created November 15, 2012 21:30
dataset loader
# IPython log file
from pyon.ion.stream import StandaloneStreamPublisher
from ion.services.dm.utility.granule_utils import time_series_domain
from ion.services.dm.utility.granule import RecordDictionaryTool
import numpy as np
import time
#params = ['time','temp']
@lukecampbell
lukecampbell / wrapper.py
Created November 15, 2012 18:46
IPython gevent wrapper
import sys
import select
import gevent
def stdin_ready():
infds, outfds, erfds = select.select([sys.stdin], [], [], 0)
if infds:
return True
else:
return False
@jboner
jboner / latency.txt
Last active May 5, 2025 12:23
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
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@lukecampbell
lukecampbell / couch
Last active December 14, 2015 17:09
utility scripts
#!/usr/bin/env ruby
couchdb = "http://localhost:5984/"
if ARGV[0] == 'admin'
couchdb = couchdb + '_utils/index.html'
exec 'open ' + couchdb
elsif ARGV[0] == 'wipe'
require 'couchrest'
cr = CouchRest.new('http://localhost:5984')
@tmc
tmc / gist:777085
Created January 12, 2011 23:08
multiprocessing gevent chat example
import sys
import gevent
from gevent.monkey import patch_all; patch_all()
from gevent import server, event, socket
from multiprocessing import Process, current_process, cpu_count
"""
Simple multiprocess StreamServer that proxies messages between clients.
Avoids using a multiprocessing.Event since it blocks on a semaphore.