Skip to content

Instantly share code, notes, and snippets.

View cjbischoff's full-sized avatar

Christopher cjbischoff

View GitHub Profile
@cjbischoff
cjbischoff / git.migrate
Created April 17, 2019 16:04 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@cjbischoff
cjbischoff / latency.txt
Created April 17, 2017 20:42
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
@cjbischoff
cjbischoff / latency.markdown
Created April 17, 2017 20:42 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

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

@cjbischoff
cjbischoff / System Design.md
Created April 14, 2017 18:28 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@cjbischoff
cjbischoff / latency.txt
Created April 14, 2017 16:58 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
@cjbischoff
cjbischoff / gnu-utils.sh
Created December 20, 2016 18:28
Installs and upgrades OS X tools and command-line utils using Homebrew. Replaces the cruft with GNU's versions.
#!/bin/bash
#
# Installs and upgrades OS X tools and command-line utils using [Homebrew] (www.brew.sh).
# This will use GNU's available toolset.
#
# # #
# Function to install homebrew [ http://brew.sh ]
# # #
install_brew() {
@cjbischoff
cjbischoff / brew.sh
Created December 20, 2016 18:27 — forked from NigoroJr/brew.sh
GNU-ify Mac OS X
#!/bin/sh
if [ `which brew | grep 'brew$'` = "" ]; then
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
fi
if [ ! -e ~/.zshrc_local -o `grep '\$(brew --prefix coreutils)/libexec/gnubin' ~/.zshrc_local` = "" ]; then
echo 'export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"' >> ~/.zshrc_local
fi
@cjbischoff
cjbischoff / new_bashrc.sh
Created August 13, 2012 15:13 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo: https://github.com/josephwecker/bashrc_dispatch
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# -- DEPRICATED --
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch
# (Thanks gioele)
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?