This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# benchmark Mandelbrot set (aka Brooks-Matelski set) on OLED | |
# scruss, 2025-01 | |
# MicroPython | |
# -*- coding: utf-8 -*- | |
from machine import Pin, I2C, idle, reset, freq | |
# from os import uname | |
from sys import implementation | |
from ssd1306 import SSD1306_I2C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM --- Music | |
REM --- Reads easy to generate music commands and plays them. | |
REM --- Any four voice song can be played by simply changing the | |
REM --- DATA statements after the label Song: | |
DEFINT A-Z | |
REM --- Display Picture | |
OPEN "MusicPict" FOR INPUT AS 1 | |
PICTURE (100,50),INPUT$(LOF(1),1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# scruss, 2024-10 | |
from itertools import combinations | |
from textwrap import wrap | |
import random | |
random.seed(None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------------------------------ | |
//------------------------------------------------------------------------------ | |
// 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
NewerOlder