Skip to content

Instantly share code, notes, and snippets.

View mmoskal's full-sized avatar

Michał Moskal mmoskal

View GitHub Profile
@mmoskal
mmoskal / population.md
Created April 8, 2023 17:17
time ever lived in human history
year population (M) time pop.avg (M) years lived (B) total years lived (B) % years lived
-190000 0
-50000 2 140000 1 140 140 6.45
-8000 5 42000 3.5 147 287 13.21
-7000 7 1000 6 6 293 13.49
-6000 14 1000 10.5 11 304 14
-5000 27 1000 20.5 21 325 14.96
-4000 50 1000 38.5 39 364 16.76
-3000 100 1000 75 75 439 20.21
@mmoskal
mmoskal / population.mjs
Created April 8, 2023 17:16
compute time ever lived in human history
import { writeFileSync } from "node:fs"
// data from https://en.wikipedia.org/wiki/Estimates_of_historical_world_population PRB column
// and https://www.prb.org/articles/how-many-people-have-ever-lived-on-earth
const data = `
-190000 0
-50000 2M
-8000 5M
0 300M
1200 450M
@mmoskal
mmoskal / encoder.ts
Created May 30, 2019 17:21
rotary encoder for makecode
// based on https://github.com/PaulStoffregen/Encoder/blob/master/Encoder.h
class Encoder {
state: number
position: number
onChange: (n: number) => void
constructor(public pinA: DigitalInOutPin, public pinB: DigitalInOutPin) {
this.state = 0
this.position = 0
@mmoskal
mmoskal / test.txt
Created May 4, 2016 16:31
something
Hello world!