Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🦆

Stewart Russell scruss

💭
🦆
View GitHub Profile
@scruss
scruss / quakerdate.sh
Created Sep 26, 2022
quakerdate.sh - return today's (or a specified) date in Quaker (Society of Friends) customary date format
View quakerdate.sh
#!/usr/bin/env bash
# quakerdate - use GNU date to generate Quaker (Society of Friends)
# customary date format. Any args will be passed as the date to print
# scruss, 2022-09
# Mon 26 Sep 2022 -> Second day, the twenty-sixth of ninth month 2022
ordinals=(none First Second Third Fourth Fifth Sixth Seventh Eighth \
Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth \
Fifteenth Sixteenth Seventeenth Eighteenth Nineteenth \
Twentieth Twenty-first Twenty-second Twenty-third \
@scruss
scruss / art_data.c
Last active Aug 26, 2022
stringart - from the MGR windowing desktop environment
View art_data.c
/* Copyright (c) 1987 Bellcore
* All Rights Reserved
* Permission is granted to copy or use this program, EXCEPT that it
* may not be sold for profit, the copyright notice must be reproduced
* on copies, and credit should be given to Bellcore where it is due.
* BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
*/
/* $Header: art_data.c,v 4.2 88/06/22 14:37:09 bianchi Exp $
$Source: /tmp/mgrsrc/demo/misc/RCS/art_data.c,v $
*/
@scruss
scruss / ThePrimeMinisterWontResign-OliverDarkshire.py
Created Jul 9, 2022
"The Prime Minister Won't Resign", an implementation of Oliver Darkshire's one page RPG - https://twitter.com/deathbybadger/status/1545372201402114049
View ThePrimeMinisterWontResign-OliverDarkshire.py
#!/usr/bin/env python3
#
# Implementation of Oliver Darkshire's one page RPG
# "The Prime Minister Won't Resign", published 2022-07-08
# https://twitter.com/deathbybadger/status/1545372201402114049
#
# written in deliberately simple python by scruss, 2022-07
# -*- coding: utf-8 -*-
import random
@scruss
scruss / STBEESSP.BAS
Created Jun 15, 2022
Speaks a limerick from SPO256-AL2 text phonemes: SPO256-AL2 emu on RC2040, CP/M MBasic
View STBEESSP.BAS
10 REM St Bees - scruss, 2022-06 - SPO256-AL2 emu on RC2040, CP/M MBasic
20 KAL$="PA1PA2PA3PA4PA5/OY/AY/EH/KK3/PP/JH/NN1/IH/TT2/RR1/AX/MM/TT1/DH1/IY/EY/DD1/UW1/AO/AA/YY2/AE/HH1/BB1/TH/UH/UW2/AW/DD2/GG3/VV/GG1/SH/ZH/RR2/FF/KK2/KK1/ZZ/NG/LL/WW/XR/WH/YY1/CH/ER1/ER2/OW/DH2/SS/NN2/HH2/OR/AR/YR/GG2/EL/BB2/"
30 ALV$="00*01*02*03*04*05*06*07*08**09*10*11**12*13**14**15*16*17**18**19*20*21**22**23*24*25**26*27**28**29*30*31**32*33**34**35*36**37*38*39**40*41**42**43*44*45*46*47*48*49**50*51**52**53*54**55*56**57**58*59*60*61**62*63***"
40 DEF FNLOOKUP$(N$)=LEFT$(RIGHT$(ALV$,LEN(KAL$)-INSTR(KAL$,N$)+1),2)
50 READ PHON$,TEXT$
60 IF PHON$="end" THEN GOTO 175
70 PRINT "(";TEXT$;")"
80 WHILE (LEN(PHON$)>0)
90 SPCPOS%=INSTR(PHON$," ")
100 IF SPCPOS%=0 THEN P$=PHON$:PHON$="" ELSE P$=LEFT$(PHON$,SPCPOS%-1):PHON$=RIGHT$(PHON$,LEN(PHON$)-SPCPOS%)
@scruss
scruss / computer_literacy_helvetica_outline.ps
Created May 30, 2022
lettering akin to BBC's computer literacy project
View computer_literacy_helvetica_outline.ps
%!PS-Adobe-2.0
%%BoundingBox: 36 400 286 550
%%HiResBoundingBox: 35.999999 399.995988 286.001991 550.007983
%%Title: modified from Blue Book Program 16, on page 203
%%EndComments
% scruss, 2022-05
% see https://stardot.org.uk/forums/viewtopic.php?f=3&t=24845
/makeoutlinedict 7 dict def
@scruss
scruss / alfred_pc.bas
Created Jan 23, 2022
MAD Magazine October 1985 BASIC type-in
View alfred_pc.bas
5 REM Mad Computer Edition with Logo Code October 1985 - PC GW-BASIC
6 REM https://redd.it/s9sudr
10 SIZE=1.2:XC=150:YC=110
20 KEY OFF:SCREEN 1:CLS:COLOR 7,0
30 READ X,Y,X1,Y1
40 IF X=999 THEN GOTO 90
50 FX=X*SIZE+XC:FY=199-(Y+YC)
60 LX=X1*SIZE+XC:LY=199-(Y1+YC)
70 LINE (FX,FY)-(LX,LY),2:LINE (FX+1,FY)-(LX+1,LY),2
80 GOTO 30
View alfred_bbc.bas
10 SIZE=1.2:XC=640:YC=512:SCL=5
20 MODE 2:COLOUR 4:COLOUR 135:GCOL 0,1:CLS:VDU 23,1,0;0;0;0;
30 READ X,Y,X1,Y1
40 IF X=999 THEN GOTO 90
50 FX=SCL*X*SIZE+XC:FY=SCL*Y+YC
60 LX=SCL*X1*SIZE+XC:LY=SCL*Y1+YC
70 MOVE FX,FY:DRAW LX,LY: REM MOVE FX+1,FY:DRAW LX+1,LY
80 GOTO 30
90 VDU 31,2,30:PRINT"WHAT, ME WORRY?";
100 A$=INKEY$(0):IF A$="" THEN GOTO 100
@scruss
scruss / snoopycal.sh
Created Dec 11, 2021
snoopycal.sh - output old-school ASCII art Snoopy calendar
View snoopycal.sh
#!/bin/sh
# snoopycal.sh - output old-school ASCII art Snoopy calendar
# scruss, 2021-11
#
# optional argument: year
# otherwise, chooses one for you
#
# requires: cal, banner
# typically in the ncal and sysvbanner packages
#
@scruss
scruss / bitfield_quad.html
Created May 21, 2021
2d plotting on canvas
View bitfield_quad.html
<canvas id="c" width="1024" height="1024">
<script>
const context = c.getContext('2d');
for (let x = 0; x < 256; x++) {
let y = 255 - 4 * 256 * ((x / 256) - 0.5)**2;
context.fillRect(x*4, y*4, 4, 4);
}
</script>
@scruss
scruss / lazy_caterer.py
Created May 12, 2021
lazy caterer plots - coloured lines, but rather dull
View lazy_caterer.py
#!/usr/bin/python3
# lazy caterer sequence - 'thank' you josh millard ...
# scruss - 2021-05
# usage: lazy_caterer.py [lines] > output.eps
from random import uniform
from math import sin, cos, radians
from sys import argv
lines = 9