Skip to content

Instantly share code, notes, and snippets.

View cjbischoff's full-sized avatar

Christopher cjbischoff

View GitHub Profile
# KMS.tf
resource "aws_kms_key" "kms_key" {
policy = <<POLICY
{
"Version": "2012-10-17",
"Id": "${var.name}-key",
"Statement": [
{
"Sid": "Enable IAM User Permissions",
variable "bucket_name" {}
variable "name" {}
variable "s3logs_bucket_name" {}
variable "database_kms_key_arn" {}
variable "read_only_roles" {
type = "list"
@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.
/var/folders/4s/l39wbkz55tx10gb1lfdvj6th0000gn/T/python-build.20181120064129.76625 ~
11/20 06:41:31 [NOTICE] Downloading 1 item(s)
11/20 06:41:31 [NOTICE] Allocating disk space. Use --file-allocation=none to disable it. See --file-allocation option in man page for more details.
[#3fb641 6.1MiB/16MiB(37%) CN:1 DL:7.0MiB ETA:1s]
[#3fb641 13MiB/16MiB(80%) CN:1 DL:7.0MiB]
11/20 06:41:34 [NOTICE] Download complete: /private/var/folders/4s/l39wbkz55tx10gb1lfdvj6th0000gn/T/python-build.20181120064129.76625/Python-3.6.7.tar.xz
@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