Skip to content

Instantly share code, notes, and snippets.

View rob-smallshire's full-sized avatar

Robert Smallshire rob-smallshire

View GitHub Profile
@rob-smallshire
rob-smallshire / temperature.py
Last active August 22, 2019 06:53
Dynamic temperature types in Python
import operator
ABSOLUTE_ZERO = 0
class Temperature:
_scale_classes = {}
_promotion_rules = {}
@classmethod
@rob-smallshire
rob-smallshire / roundedcube.scad
Created January 25, 2020 13:12 — forked from groovenectar/roundedcube.scad
roundedcube.scad - Fork me and make me better!
// More information: https://danielupshaw.com/openscad-rounded-corners/
// Set to 0.01 for higher definition curves (renders slower)
$fs = 0.15;
module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;
translate_min = radius;
@rob-smallshire
rob-smallshire / maybe.py
Created November 15, 2022 16:28
A maybe (?Monad)
import random
class Maybe:
def __init__(self, item=None):
self._item = item
def __iter__(self):
if self._item is not None:
@rob-smallshire
rob-smallshire / stille.py
Created January 13, 2023 10:39
Audio power from a WAV file
from dataclasses import dataclass
import librosa
import numpy as np
import matplotlib.pyplot as plt
@dataclass
class Audio:
samples: np.ndarray
rate: int
@rob-smallshire
rob-smallshire / BBC-Micro-Model-A,-Model-B-or-Model-B_.kbd.json
Last active October 28, 2025 14:56
BBC Micro Model A, Model B or Model B+
[
{
"backcolor": "#201D1E",
"name": "BBC Micro Model A, Model B or Model B+",
"author": "Robert Smallshire"
},
[
{
"x": 2.5,
"c": "#d34b3d",
@rob-smallshire
rob-smallshire / BBC-Micro-Master-128.kbd.json
Last active October 29, 2025 14:31
BBC Micro Master 128
[
{
"backcolor": "#201D1E",
"name": "BBC Micro Master 128",
"author": "Robert Smallshire"
},
[
{
"x": 1.75,
"c": "#d34b3d",