Skip to content

Instantly share code, notes, and snippets.

View polyrand's full-sized avatar

Ricardo Ander-Egg polyrand

View GitHub Profile
import binascii
import sqlite3
import collections
import math
import re
RE_SPLIT = re.compile(r'[^A-Za-z0-9_]+')
def tokenize(s):
# this is super basic and should be replaced with a real tokenizer
@polyrand
polyrand / README-setup-tunnel-as-systemd-service.md
Created November 26, 2020 18:28 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@polyrand
polyrand / latency.txt
Created September 1, 2020 23:52 — 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