Skip to content

Instantly share code, notes, and snippets.

michiel / cors-nginx.conf
Created Jul 5, 2011
Wide-open CORS config for nginx
View cors-nginx.conf
# Wide-open CORS config for nginx
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
michiel / lat_lng_jitter.js
Last active Feb 10, 2021
Add jitter to latitude/longitude
View lat_lng_jitter.js
// Make a few assumptions and add noise to latitude/longitude position
// Ex, console.log(jitter(-26.4853429150483, -49.072945734375, 5));
var rad_Earth = 6378.16;
var one_degree = (2 * Math.PI * rad_Earth) / 360;
var one_km = 1 / one_degree;
function randomInRange(from, to, fixed) {
michiel /
Created Oct 27, 2020
clean out git directories to free up space
# Clean out git repos to save space
for d in `find . -maxdepth 1 -type d`
pushd . > /dev/null
cd "$d"
echo "Trying $d"

Transparent Git Encryption

This document has been modified from its [original format][m1], which was written by Ning Shang ( It has been updated and reformatted into a [Markdown][m2] document by [Woody Gilk][m3] and [republished][m4].


When working with a remote git repository which is hosted on a third-party storage server, data confidentiality sometimes becomes

michiel / latency.txt
Created Oct 4, 2020 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
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
import svgwrite
import math
import json
class Pyramid:
def __init__(self, data, filename, height=500): = data
self.filename = filename
self.height = height
self.width = 2 * height
michiel / weasel-words.json
Created Jul 30, 2020
List of weasel words
View weasel-words.json
"all the time",
"as much as",
"best practice",
"can be",
michiel / cisq-model.puml
Created Jul 2, 2020
CISQ Quality Model
View cisq-model.puml
skinparam linetype poly
rectangle "Quality Dimension" {
agent Reliability
agent Security
agent Efficiency
agent Maintainability
agent Size
michiel /
Created Aug 16, 2017
expect + ssh + scp with password to collect data from a list of servers
michiel /
Created Apr 8, 2020
List active cloudfront deployments with AWS CLI and jq
aws --profile=$AWS_PROFILE \
--region=$AWS_REGION \
cloudfront list-distributions \
| jq '.DistributionList.Items[].Origins.Items[] | {Id: .Id, OriginPath: .OriginPath}'