Skip to content

Instantly share code, notes, and snippets.

View JohnAllen's full-sized avatar

John Allen JohnAllen

View GitHub Profile
@justsml
justsml / fetch-api-examples.md
Last active February 24, 2024 18:05
JavaScript Fetch API Examples
@sebastianwebber
sebastianwebber / pg-notify-parallel.go
Last active March 11, 2024 15:45
postgres listen/notifiy with golang and `go-pg`
package main
import (
"log"
"time"
"github.com/go-pg/pg"
)
const maxWorkers = 5
@chrishulbert
chrishulbert / main.rs
Created August 27, 2023 13:15
Interactive Brokers TWS API in Rust
// MIT licensed.
use std::net::TcpStream;
use std::io::{Read, Write};
use std::sync::mpsc::channel;
use std::thread;
fn main() {
let mut stream = TcpStream::connect("127.0.0.1:7496").expect("connect");
stream.set_nodelay(true).expect("nodelay"); // Because we're wannabe HFT traders.
@magickatt
magickatt / github_clone_using_token.sh
Created September 6, 2019 17:31
Clone a GitHub repository using a Personal Access Token
export GITHUB_USER=magickatt
export GITHUB_TOKEN=secret
export GITHUB_REPOSITORY=magickatt/ContainerisingLegacyApplicationsTalk
git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
@karpathy
karpathy / min-char-rnn.py
Last active May 21, 2024 03:56
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@jboner
jboner / latency.txt
Last active May 21, 2024 18:29
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