Skip to content

Instantly share code, notes, and snippets.

View a2435191's full-sized avatar

William Bradley a2435191

  • Ithaca, NY
  • 22:18 (UTC -04:00)
View GitHub Profile
@a2435191
a2435191 / SIC1.lean
Created October 13, 2025 06:54
Simulator for the single-instruction (subleq) computer from the game SIC-1
-- https://jaredkrinke.itch.io/sic-1
namespace SIC1
@[reducible] def Index := UInt8
@[reducible] def Data := Int8
namespace Index
@[match_pattern, simp] def max : Index := 252
# text to 3-bit RGB image, one byte per bit. endianness might be important
import sys
import math
text = bytes(sys.argv[1], encoding='utf-8')
n_text_bits = len(text) * 8
width_str = sys.argv[2]
width = int(width_str)
@a2435191
a2435191 / nyt_election_data.py
Last active August 24, 2022 02:19
Extract county-level election data from the NYT API.
import asyncio
from datetime import datetime
import pandas
import aiohttp
import json
async def get_data(url: str) -> dict[str, tuple[pandas.DataFrame, datetime]]:
"""Extract county-level election data from the NYT API.
@a2435191
a2435191 / freeNYT.js
Created March 19, 2022 01:48
New York Times paywall workaround
(function () {
let container = document.getElementById("app")
.getElementsByTagName("div")[0]
.getElementsByTagName("div")[0];
container.style.position = "static"; // allow scroll
for (suspect of Array.from(container.getElementsByTagName("div"))) {
if (getComputedStyle(suspect).background.includes("linear-gradient")) {
suspect.style.background = "none"; // remove shadow gradient
@a2435191
a2435191 / death_coords_mod.java
Created January 29, 2022 07:39
My first Forge Minecraft mod! It prints your last location whenever you die.
package com.example.a2435191.death_coords;
import net.minecraft.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.Position;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;