As configured in my dotfiles.
start new:
tmux
start new with session name:
As configured in my dotfiles.
start new:
tmux
start new with session name:
// jquery style `extend` work in ES5 compatible envs | |
var extend = function (obj) { | |
var args = Array.prototype.slice.call(arguments, 1); | |
args.forEach( function (source) { | |
for (var prop in source) | |
if (source.hasOwnProperty(prop)) obj[prop] = source[prop]; | |
}); | |
return obj; | |
}; |
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 |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
# Applies Q.nbind to all redis operations and returns a wrapped client | |
_ = require("underscore")._ | |
Q = require "q" | |
nbindOps = (client) -> | |
functions = _.functions client | |
# All the ops are available as upper/lowercase functions, I exploit this | |
# to filter out the Redis operations from the other functions of the client | |
# |
module type S = sig | |
type key | |
type +'a t | |
val empty : 'a t | |
val is_empty : 'a t -> bool | |
val add : key -> 'a -> 'a t -> 'a t | |
val find : key -> 'a t -> 'a | |
val remove : key -> 'a t -> 'a t | |
val mem : key -> 'a t -> bool | |
val iter : (key -> 'a -> unit) -> 'a t -> unit |
/** | |
* Given "0-360" returns the nearest cardinal direction "N/NE/E/SE/S/SW/W/NW" | |
*/ | |
export function getCardinal(angle) { | |
/** | |
* Customize by changing the number of directions you have | |
* We have 8 | |
*/ | |
const degreePerDirection = 360 / 8; |
WARNING: If you're reading this in 2021 or later, you're likely better served by reading:
(This gist was created in 2013 and targeted the legacy GOPATH mode.)
$ ssh -A vm
$ git config --global url."[email protected]:".insteadOf "https://github.com/"
assert = (require 'chai').assert | |
Q = require 'q' | |
util = require './util' | |
describe '.any()', -> | |
it 'should fail when no promise resolves', (done) -> | |
fns = [ |