Skip to content

Instantly share code, notes, and snippets.

View scruss's full-sized avatar
💭
🦆

Stewart Russell scruss

💭
🦆
View GitHub Profile
@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 "_________________"
@scruss
scruss / amazin.bas
Last active November 18, 2023 20:41
AMAZIN - by Jack Hauber. For DEC EDUSYSTEM 20 BASIC, from DEC EDU Newsletter Issue Number 4 (1972)
1 REM amazin
2 REM from https://archive.org/details/digital_edu_number_4/page/n1/mode/2up
100 RANDOMIZE
110 DIM W(25,103),V(25,103)
120 PRINT "WHAT ARE YOUR WIDTH AND LENGTH?"
121 INPUT H,V
122 PRINT
130 IF H<>1 THEN 150
131 IF V<>1 THEN 150
132 PRINT "MEANINGLESS DIMENSIONS, TRY AGAIN"
@scruss
scruss / is_z80.sh
Created February 25, 2023 04:56
linux tool to output the "Z80ness" of a CP/M-80 binary: the higher the number, the more likely the binary will only run on a Z80 chip
#!/bin/bash
# is_z80 - guess if a binary is z80 or 8080
# from frequency of two-byte Z80 instructions
# scruss, 2023-02
# this might need gnu awk. Needs bc for sure
file="$1"
if
[ "$#" -eq 0 ]
@scruss
scruss / hootnanny-cleaned_up.py
Last active December 19, 2022 21:29
Slightly imperfect Python simulation of the "HOOT-NANNY" (or Magic Designer) drawing toy
#!/usr/bin/env python3
# hootnanny.py - simulate Hoot-Nanny / Magic Designer drawing toy
# Currently hard-coded to output figure "25KM" in HP-GL,
# a simple but somewhat obsolete plotting language.
# Output figures as close to actual sizes as I could manage.
# All dimensions in inches, unfortunately, but HP-GL is bilingual.
# scruss, 2022-02 - code cleanup - 2022-12
# Licence: CC-BY-SA - share freely, but credit me and make your
# improvements freely available for all
# -*- coding: utf-8 -*-