Skip to content

Instantly share code, notes, and snippets.

View scruss's full-sized avatar
💭
Will never accept Copilot-generated issues and PRs, Also: 🦆

Stewart Russell scruss

💭
Will never accept Copilot-generated issues and PRs, Also: 🦆
View GitHub Profile
@scruss
scruss / mqtt_cheerlights.py
Last active December 5, 2024 00:21
a very simple Cheerlights/NeoPixel MQTT client for MicroPython
# -*- coding: utf-8 -*-
# scruss, 2024-12
# MicroPython
"""
a very simple Cheerlights MQTT client for MicroPython
Uses Peter Hinch's MicroPython Asynchronous MQTT library
— https://github.com/peterhinch/micropython-mqtt/
Install it with:
mpremote mip install github:peterhinch/micropython-mqtt
@scruss
scruss / framebuf_pattern_pbm-big2.py
Created November 27, 2024 21:57
write a threatening pattern to a pbm
#!/usr/bin/env micropython
# write a threatening pattern to a pbm
# scruss, 2024-11
# MicroPython has framebuf, but no math.isqrt()
# Python3 has no framebuf, but has math.isqrt()
import framebuf
from math import sqrt
WIDTH = 1280 # original target was a 128 x 64 OLED
@scruss
scruss / threes.py
Last active October 21, 2024 02:03
threes.py - re-split several 3-letter words into (several-1) new 3-letter words
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# scruss, 2024-10
from itertools import combinations
from textwrap import wrap
import random
random.seed(None)
@scruss
scruss / csvthing.py
Created October 12, 2024 13:34
csvthing - clean up header of (slightly) nasty CSV so it'll work with SQLite
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# csvthing - clean up horrid csv so it will work with q and SQLite
# scruss, 2022-06
import sys
import csv
if len(sys.argv) < 2:
@scruss
scruss / capacitor.sh
Created September 18, 2024 15:37
capacitor discharge calculator shell script
#!/bin/zsh -f
# capacitor discharge - scruss, 2023-11
# - this should work with bash too but the formatting may be off
# - weird narrow format was designed for thermal printer output
if
[ "$#" -lt 3 ]
then
echo "usage: $0 resistance capacitance voltage [V₀]"
exit 1
@scruss
scruss / ES100_Arduino.ino
Last active August 18, 2024 20:56
minimally modified EverSet ES100 WWVB board Arduino example
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// es100_host_arduino.c
//
// Xtendwave ES100 Example Host MCU Code for Arduino - version 0002
//
// Copyright 2013 Xtendwave
//
// THIS SOFTWARE IS PROVIDED TO YOU "AS IS," AND WE MAKE NO EXPRESS OR IMPLIED
// WARRANTIES WHATSOEVER WITH RESPECT TO ITS FUNCTIONALITY, OPERABILITY, OR USE,
@scruss
scruss / raincode.sh
Created July 24, 2024 02:01
raincode.sh - create a plausible random UK Ministry of Supply-style "Rainbow Code" name
#!/bin/bash
# raincode.sh - create a plausible random UK Ministry of Supply-style
# "Rainbow Code" name
# see: https://en.wikipedia.org/wiki/Rainbow_Code
# scruss, 2024-07
rainbow=(Black Blue Brown Green Indigo \
Jade Orange Pink Purple Red \
Violet Yellow)
@scruss
scruss / LANDR2.FC
Created June 18, 2024 19:21
Jim Storer's LANDER (Focal) patched to maybe remove ancient bug
01.04 T "CONTROL CALLING LUNAR MODULE. MANUAL CONTROL IS NECESSARY"!
01.06 T "YOU MAY RESET FUEL RATE K EACH 10 SECS TO 0 OR ANY VALUE"!
01.08 T "BETWEEN 8 & 200 LBS/SEC. YOU'VE 16000 LBS FUEL. ESTIMATED"!
01.11 T "FREE FALL IMPACT TIME-120 SECS. CAPSULE WEIGHT-32500 LBS"!
01.20 T "FIRST RADAR CHECK COMING UP"!!!;E
01.30 T "COMMENCE LANDING PROCEDURE"!"TIME,SECS ALTITUDE,"
01.40 T "MILES+FEET VELOCITY,MPH FUEL,LBS FUEL RATE"!
01.50 S A=120;S V=1;S M=32500;S N=16500;S G=.001;S Z=1.8
02.10 T " "%3,L," "FITR(A)," "%4,5280*(A-FITR(A))
@scruss
scruss / 1000days_concept.md
Last active July 4, 2024 11:50
Thousand Days: Concept

Thousand Days: Concept

Stewart Russell - scruss.com — 2024-03-26, at age 19999 days …

Summary

One's thousand day(s) celebration occurs every thousand days of a person's life. They are meant to be a recognition of getting this far, and are celebrated at the person's own discretion.

1 REM TAIPAN - HAYDEN BOOK CO COPYRIGHT 1986
2 REM BY ART CANFIL, KARL ALBRECHT, AND JIM MCCLENAHAN
3 REM TYPED, NOT EXHAUSTIVELY CHECKED, AND MILDLY TWEAKED BY DEAN OISBOID 2022
4 REM REPLACED DIRECT CTRL-G CALLS WITH BP$
5 REM INITIALIZATION (10-50)
10 HOME :A$ = " ":W$ = "ELDER BROTHER YU":LY$ = "LI YUEN":YS$ = "YAMATO & SMYTHE":TC$ = "O, S, T, A, P, OR R"
11 B$ = " "
14 REM OZZY REPLACED JUST BELOW WITH PROPER CTRL-G
15 BP$ = CHR$(7)
20 VTAB 4: INVERSE : PRINT A$: HTAB 15: PRINT "T A I P A N:": NORMAL : HTAB 13: PRINT "_________________"