Skip to content

Instantly share code, notes, and snippets.

View BlackVegetable's full-sized avatar

Devin Ekins BlackVegetable

View GitHub Profile
@KazeroG
KazeroG / gist:ed8c88928e5a7a3383f606546a9fa3f4
Created December 3, 2019 06:39
GitHub Api download zip or tarball link
You can `wget` your way out of the GitHub repo to get a tar file ([archive][1]):
wget --no-check-certificate https://github.com/User/repo/archive/master.tar.gz
# better, if the certificate authorities are present:
wget https://github.com/User/repo/archive/master.tar.gz
will get you a file named 'master' from the user 'User''s repo 'repo'.
The [updated V3 API url][2] is:
@mpilquist
mpilquist / philosophers.scala
Last active April 28, 2023 23:31
Dining Philosophers with FS2
/*
scalaVersion := "2.12.7"
resolvers += Resolver.sonatypeRepo("snapshots")
libraryDependencies += "co.fs2" %% "fs2-core" % "1.0.1-SNAPSHOT"
*/
import cats._
import cats.implicits._
import cats.effect._
@BlackVegetable
BlackVegetable / collapsing_die.py
Last active February 9, 2017 20:05
A collapsing die simulator
import random
def collapse_die(dice_count, dice_size):
'''
Collapse on a 1, rerolling remaining dice.
All 1s => 0.
'''
# Error checking.
if dice_count < 1:
@jboner
jboner / latency.txt
Last active June 22, 2024 06:13
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