Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🦆

Stewart C. Russell scruss

💭
🦆
View GitHub Profile
@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
View potentiometer.py
# micropython for raspberry pi pico
# potentiometer between AGND and 3V3, with the wiper going to ADC pin 2
# prints 0-100 depending on how far potentiometer is turned
# 3 columns so the Thonny plotter will scale correctly
from machine import Pin, ADC
from time import sleep
led = Pin(25, Pin.OUT)
adc = ADC(2)
@scruss
scruss / scruss-palm_pen.scad
Created Jan 15, 2021
Mirror of Customizable Palm Pen Holder OpenSCAD code - https://www.thingiverse.com/thing:4178663
View scruss-palm_pen.scad
// palm pen holder - scruss, -customizable!
// 2021-01 - increased max pen size to 22 mm
// 2020-02 - revised nut catch - a bit snug before
//CUSTOMIZER VARIABLES
// Hand Width - mm
hand_width = 110; // [70:150]
// Hand Thickness - thumb side - mm
thumb_thick = 35; // [20:50]
View HBYDRAW.BAS
10 PR# 3
20 TEXT : HOME
30 HTAB 11
40 HTAB 11
50 PRINT " %,,,,,,,,,,,,,,,,,,,,,,,,, "
60 HTAB 11
70 PRINT " (,,,,,,,*&@@@@@@@@@@@@@@@%,,,,,,,,% "
80 HTAB 11
90 PRINT " ,,,,,,, @@@@@@@@@@@@@@@@@@@@@@@@@@,,,,,,/ "
100 HTAB 11
@scruss
scruss / main.py
Created Jul 18, 2020
Itsy Bitsy M0 Express IO demo
View main.py
# Itsy Bitsy M0 Express IO demo
# Welcome to CircuitPython 2.2 :)
# Updated for CircuitPython 6.0.0-alpha.1: scruss, 2020-07
import board
import gc
import time
from digitalio import DigitalInOut, Direction, Pull
from analogio import AnalogIn
import audioio
@scruss
scruss / PLOTPOURRI2-BRANDY.bas
Last active Apr 16, 2020
PLOTPOURRI for BBC Micro
View PLOTPOURRI2-BRANDY.bas
10 REM ******************
20 REM * *
30 REM * PLOTPOURRI *
40 REM * S COTTRELL *
50 REM * SEPT 1979 *
60 REM * *
70 REM ******************
80 REM Washington Apple Pi Journal October 1979
90 REM bbc basic / matrix brandy port - scruss, 2019-07
100 MODE 1
@scruss
scruss / makermask-tc.txt
Last active Mar 31, 2020
makermask.com terms and conditions - as viewed March 31, 2020, 11:41:09 a.m. EDT
View makermask-tc.txt
https://www.makermask.com/terms-and-conditions.html
Maker Mask & RPrime Terms and Conditions
Last updated: March 29, 2020
The following are terms and conditions (“Terms and Conditions”)
of a legal agreement between you and RPrime Foundation, a Washington
State non-profit corporation based in Seattle, Washington and its
affiliates (collectively, “RPrime”, “we”, “us” or “our”).
View 10printbbc.bas
1MODE4:VDU23,224,24,48,96,193,131,6,12,24:VDU23,225,24,12,6,131,193,96,48,24
2PRINTCHR$(224.5+RND(1));:GOTO2
RUN
@scruss
scruss / taxman.bas
Created Nov 3, 2019
Taxman - 1973 PCC Basic game reformatted for 40 columns
View taxman.bas
100 REM TAXMAN - first published in People's Computer Company
104 REM vol. 2, no. 1 - September 1973
108 REM edited for 40 column screens - scruss, 2019-11
112 DIM l(50),t(10)
116 PRINT
120 PRINT
124 PRINT "Hi, I'm the taxman"
128 PRINT "Do you want the regulations?"
132 PRINT "(1=Yes, 0=No)";
136 INPUT r