Skip to content

Instantly share code, notes, and snippets.

View onpaws's full-sized avatar
🚴‍♂️
building things

Pat onpaws

🚴‍♂️
building things
View GitHub Profile
@onpaws
onpaws / tip.md
Created August 11, 2020 08:55
postgres-as-nosql

https://news.ycombinator.com/item?id=24117607

These days you can even just tune pgsql to support kv store formats And you can turn off fsync! Though if you do, disable synchronous_commit instead for most of the performance but none of the potential data corruption (you're still risking data loss, of course, just not corruption).

convert -delay 80 -loop 0 +dither "$1" "$2" ~/Desktop/"`date +"%b %d, %Y, %H.%M.%S %p"`.gif"
@onpaws
onpaws / latency.txt
Created June 26, 2020 09:45 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
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
@onpaws
onpaws / craig-federighi-interview
Created March 25, 2020 13:37
Craig Federighi Interview notes
Craig Federighi
https://www.youtube.com/watch?v=43sjym5ZS68
1. Do what you love. Enjoy the journey
2. Work with people whose work you admire
3. Pay attention
4. Never stop acting like the new on the team
@onpaws
onpaws / why-javascript
Created March 25, 2020 13:35
Why JavaScript?
Why JavaScript?
Main strengths:
* The ecosystem is pretty strong and constantly evolving. Lots of companies and individuals are putting a serious amount of work into making high-quality tooling and libraries. (Although with that also comes a lot of lower quality stuff and its sometimes hard to tell)
* The language isn't owned by any single company and is well specified
* TypeScript provides a powerful and flexible type system with advanced dependant-types like features. Lets you gradually evolve from a messy JS prototype to well-organized code with fairly strict type checking
* Fastest dynamic language. The performance is also quite comparable to statically typed GCed languages. (For example, you can probably get to 50%-90% of Java performance on most single-threaded workloads)
@onpaws
onpaws / curl-websocket.sh
Created February 27, 2020 03:29
new websocket snippet using curl
curl -i -N -H "Connection: Upgrade" \
-H "Upgrade: websocket" \
-H "Host: localhost:8088" \
-H "Origin: http://localhost:8088" \
http://localhost:8088
@onpaws
onpaws / HOWTO-setup-rancher-on-the-cheap.md
Last active December 7, 2024 19:01
Easily set up a single node Kubernetes+Rancher instance for fun

Kubernetes and Rancher Adventures...on the cheap

TL, DR: a guide to setup k8s clusters quickly and cheaply, optionally with Rancher for easy GUI-based admin and role management.

I wanted to learn more about k8s but didn't particularly want to commit to paying substantial $ for hosting a 'normal' Kubernetes cluster somewhere. I wanted to stick to the lowest possible budget, but still have real k8s running on a server somewhere.

This doc explains how I did that. It happens to go into Rancher but it could be any cloud native app. Intended for my own learning purposes and edification. If things go well, I might stand up some real apps with external users one day.

Cheap unmanaged k8s option

Hetzner offers 'just compute' at pretty competitive prices. While you don't get managed Kubernetes, if you're early in your k8s journey, it may be in your interest from a lowest possible cost perspective. Consider e.g. k3s_hetzner

@onpaws
onpaws / nginx-quiche-manifest.yaml
Last active November 14, 2023 06:57
HTTP/3 Sandbox
# Instant HTTP/3 sandbox
# 1. Install a version of curl with HTTP/3 support (e.g. quiche)
# TL,DR: brew install -s https://raw.githubusercontent.com/cloudflare/homebrew-cloudflare/master/curl.rb --HEAD
# More info https://developers.cloudflare.com/http3/intro/curl-brew/
# 2. Stand up an HTTP/3 server. Below is a k8s manifest using nginx + quiche
# Note: In this example, port 8080 is HTTP/1.1 and 8443 is HTTP/3 (also HTTP/2).
# HTTP/1.1 might be useful to confirm you can reach nginx at all. Then you can move onto HTTP/3.
@onpaws
onpaws / remove .gitignored files
Created February 5, 2020 19:11
Remove .gitignore'd files. (NOT retroactive. see BFG for that)
git rm -r --cached . && git add . && git commit -am "Remove .gitignore-d files"
@onpaws
onpaws / matrix.sh
Created January 27, 2020 16:10
Matrix in your terminal
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'