Skip to content

Instantly share code, notes, and snippets.

View kgriffs's full-sized avatar

Kurt Griffiths kgriffs

View GitHub Profile
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
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@kgriffs
kgriffs / bug.txt
Last active December 31, 2015 03:49 — forked from anonymous/gist:fd19f5a3895e0304dde6
bug
/ .'
.---. \/
(._.' \()
^"""^"
░░░░░░░░░▄░░░░░░░░░░░░░░▄░░░░
░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌░░░
░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐░░░
░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐░░░
░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐░░░
░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌░░░
░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌░░
░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐░░
░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌░
░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌░
@kgriffs
kgriffs / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kgriffs
kgriffs / gist:ff576a54a2a150671f01
Last active August 29, 2015 14:22 — forked from anonymous/gist:a69c01c61f6673e12146
Falcon error handling - sample code
# ==================================================
# If an error is raised while loading the module,
# and it isn't handled (or it is re-raised), it
# will go straight to the WSGI server.
# ==================================================
model = Model()
try:
model.load()
except Exception as ex:
@kgriffs
kgriffs / profiles.clj
Created March 4, 2016 21:54 — forked from jamesmacaulay/profiles.clj
My ~/.lein/profiles.clj at the moment.
{:user {:dependencies [[org.clojure/tools.namespace "0.2.3"]
[spyscope "0.1.3"]
[criterium "0.4.1"]]
:injections [(require '(clojure.tools.namespace repl find))
; try/catch to workaround an issue where `lein repl` outside a project dir
; will not load reader literal definitions correctly:
(try (require 'spyscope.core)
(catch RuntimeException e))]
:plugins [[lein-pprint "1.1.1"]
[lein-beanstalk "0.2.6"]
@kgriffs
kgriffs / pr.md
Created July 1, 2016 16:56 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@kgriffs
kgriffs / falcon_perf.rst
Created September 12, 2016 16:31 — forked from jmvrbanac/falcon_perf.rst
Performance numbers for Falcon with different servers

Setup

  1. apt-get update
  2. apt-get upgrade -y
  3. apt-get install -y apt-transport-https ca-certificates
  4. apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
  5. echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" > /etc/apt/sources.list.d/docker.list
  6. apt-get update
  7. apt-get install -y docker-engine
@kgriffs
kgriffs / __main__.py
Created September 14, 2016 15:52 — forked from jmvrbanac/__main__.py
Example Custom Gunicorn Application
"""
Sample Application
Usage:
sample [options]
Options:
-h --help Show this screen.
"""
import aumbry
@kgriffs
kgriffs / gunicorn_options.yml
Created May 10, 2017 23:46 — forked from jmvrbanac/gunicorn_options.yml
Capture Client Certificate CN from Gunicorn
bind: 0.0.0.0:8000
workers: 1
worker_class: "example.worker:CustomWorker"
timeout: 30
ca_certs: ca.crt
certfile: server.crt
keyfile: server.key
cert_reqs: 2
do_handshake_on_connect: true