Skip to content

Instantly share code, notes, and snippets.

View robey's full-sized avatar

Robey Pointer robey

View GitHub Profile
@robey
robey / apple1-rom.txt
Last active May 22, 2023 03:49
apple 1 ROM disassembly
;
; the "monitor ROM" of an apple 1 fit in one page (256 bytes).
;
; this is my attempt to take the disassembled code, give names to the
; variables and routines, and try to document how it worked.
;
;
; an apple 1 had 8KB of RAM (more, if you hacked on the motherboard), and a
; peripheral chip that drove the keyboard and video. the video was run by a
; side processor that could treat the display as an append-only terminal that
@robey
robey / polygon.cpp
Last active March 22, 2022 19:13
simple implementation of the scan-line polygon fill algorithm for arduino (allows concave sections, but not intersecting edges)
#include "polygon.h"
class Point {
public:
double x;
double y;
Point(void) : x(0.0), y(0.0) {}
Point(double x, double y) : x(x), y(y) {}
};
@robey
robey / qemu-linux.md
Created May 17, 2019 19:30
install a qemu virtual machine on linux

install qemu on host machine & launch it

sudo apt install qemu-system-x86
sudo apt install libsdl2-dev

qemu-img create -f qcow2 test.qcow2 16G

qemu-system-x86_64 -enable-kvm -m 2048 -boot d
    -nic user,model=virtio
import sys
class ProgressBar:
def __init__(self, title: str, width: int):
self.title = title
self.width = width
self.amount = 0
self.update(0)
def update(self, amount: int) -> None:
@robey
robey / kindasnappy.py
Created February 3, 2020 18:22
python snappy test code, to determine how effective different lookback window sizes are
#!/usr/bin/env python3
import argparse
import array
import itertools
import struct
import sys
from typing import Iterator, List
__title__ = "kindasnappy"

notes on using the linux laptop

  • not since 2000, some dell "latitude"?
  • looked at thinkpad x1
    • terrible reviews
    • ugly eraser is still there
    • for a "linux laptop", didn't seem to care much about linux
    • as a hardware mfctr, you can't ask me to go download an install cd and dig up custom drivers off random websites for you. that's your responsibility.
  • 2 things i wanted PC laptops to have fixed since 2000:
  • sleep works (you can close the lid) without hard-crashing or requiring a power-off
@robey
robey / biased_quantile_distribution.coffee
Last active April 30, 2018 07:12
poor man's implementation of a biased quantile distribution, from the paper "Effective Computation of Biased Quantiles over Data Streams".
util = require 'util'
class BiasedQuantileDistribution
constructor: (@percentiles = [ 0.5, 0.9, 0.95 ], @error = 0.01) ->
@buffer = []
@bufferSize = Math.floor(1 / (2 * @error))
@samples = []
@count = 0
record: (data) ->
@robey
robey / zbase64.ts
Created October 5, 2017 18:08
encode an array of ints (that tend to be close to zero) into a packed base64-ish string
/*
* zbase64 converts an array of integers to a string, and back.
* it assumes:
* - no integer will be bigger than about 2**24
* - most will be close to zero, small positive or negative numbers
* - the strings may be copy/pasted, or have poor (or zero) unicode support
*
* strategy:
* - zig-zag encode to turn small negative numbers into small positive
* numbers

My thoughts after watching the entire 12 minutes of "Child's Play" by Drake.

His (ex) girlfriend looks immaculate. He doesn't deserve her. He comes across as an asshole in his own video -- why did he write this? Does he think we'll think he's cool if he's cheating on his anniversary? He left his phone unlocked on the table while he left? Does that mean he was playing with his phone during their anniversary dinner?

(Rus thinks the fact that she's much too good for him is the point, and that he's bragging about how terrible he is.)

Who the fuck takes their girl to Cheesecake Factory for their anniversary?

Is he making fun of people who are so poor that they go to Cheesecake Factory? Just because he's a millionaire?

@robey
robey / webpack-example.md
Last active May 27, 2017 17:26
snip of how i use webpack

webpack.config.js

module.exports = {
  entry: [ "./src/jumbotron.ts" ],
  output: {
    path: __dirname + "/site/lib",
    filename: "jumbotron.js",
    library: "jumbotron"
  },