Skip to content

Instantly share code, notes, and snippets.

@virtualirfan
virtualirfan / latency.txt
Created Aug 4, 2012 — forked from h2oai/latency.txt
Latency numbers every programmer should know
View latency.txt
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
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD 150,000 ns 0.15 ms
Read 1 MB sequentially from memory 250,000 ns 0.25 ms
Round trip within same datacenter 500,000 ns 0.5 ms
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
View brew-instructions.sh
# Install `dnsmasq` and configure for *.dev domains
$ brew install dnsmasq
$ vim /usr/local/etc/dnsmasq.conf
# Reload configuration and clear cache
$ sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
$ dscacheutil -flushcache
View keybase.md

Keybase proof

I hereby claim:

  • I am virtualirfan on github.
  • I am virtualirfan (https://keybase.io/virtualirfan) on keybase.
  • I have a public key whose fingerprint is B296 7D6E 1192 2F14 CA57 098A 7B80 537F 06B8 AD47

To claim this, I am signing this object:

@virtualirfan
virtualirfan / latency.txt
Created Jan 17, 2018 — forked from eshelman/latency.txt
HPC-oriented Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers
--------------------------
L1 cache reference/hit 1.5 ns 4 cycles
Floating-point add/mult/FMA operation 1.5 ns 4 cycles
L2 cache reference/hit 5 ns 12 ~ 17 cycles
Branch mispredict 6 ns 15 ~ 20 cycles
L3 cache hit (unshared cache line) 16 ns 42 cycles
L3 cache hit (shared line in another core) 25 ns 65 cycles
Mutex lock/unlock 25 ns
L3 cache hit (modified in another core) 29 ns 75 cycles
@virtualirfan
virtualirfan / LcHoc.scala
Created Mar 17, 2018 — forked from bfleischhacker/LcHoc.scala
Using a JS Higher-Order-Component (https://github.com/viktorbergehall/lcHOC) with scala-react-interface (sri)
View LcHoc.scala
import sri.core.{ComponentConstructor, ReactClass}
import scala.scalajs.js
import scala.scalajs.js.ConstructorTag
object LcHoc {
def apply[T <: ReactClass {type PropsType; type StateType}](params: js.UndefOr[LcHocParams] = js.undefined)
(implicit tag: ConstructorTag[T]): ComponentConstructor {
type ComponentType = T
type PropsType = T#PropsType