Skip to content

Instantly share code, notes, and snippets.

@jboner
jboner / latency.txt
Last active April 29, 2024 04:26
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
@dustin
dustin / gist:951106
Created May 2, 2011 02:19
Couchbase Server Updates

Install the latest [Couchbase Server for OS X][cbserver].

Tell Terminal you want to be on the alpha track

defaults write com.couchbase.couchbase-server SUFeedURL http://appcast.couchbase.com/couchbase-alpha.xml

Check for updates.

See new stuff.

@dustin
dustin / vbucket_transfer_simulator.py
Created August 10, 2010 07:56
transfer simulator
#!/usr/bin/env python
"""
tap protocol client.
Copyright (c) 2010 Dustin Sallings <dustin@spy.net>
"""
import sys
import time
import struct
@dustin
dustin / port_adaptor.c
Created July 14, 2010 04:52
Wrapper program to make general applications into erlang ports.
/*
* Wrapper program to make general applications into erlang ports.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sysexits.h>
#include <sys/wait.h>
(defvar autocommit-dir-set '()
"Set of directories for which there is a pending timer job")
(defun autocommit-schedule-commit (dn)
"Schedule an autocommit (and push) if one is not already scheduled for the given dir."
(if (null (member dn autocommit-dir-set))
(progn
(run-with-idle-timer
10 nil
(lambda (dn)
#!/usr/bin/env ruby
require 'net/http'
require 'net/https'
user = `git config --global github.user`.strip
token = `git config --global github.token`.strip
raise "Error reading github auth" if user.empty? || token.empty?
auth = {:login => user, :token => token}