Skip to content

Instantly share code, notes, and snippets.

View rsbohn's full-sized avatar

Randall Bohn rsbohn

  • Rando Media
  • Orem Utah USA
View GitHub Profile
@rsbohn
rsbohn / create_game_tape.py
Created January 3, 2026 18:38
Nova 1210 Game Location Tape - TC08 Demo with 64 Adventure Locations
#!/usr/bin/env python3
"""Create a TU56 DECtape image with place names for a game."""
import struct
import sys
# TC08 constants
WORDS_PER_BLOCK = 129
DATA_WORDS_PER_BLOCK = 128
BLOCKS = 0o100 # 64 decimal blocks
@rsbohn
rsbohn / evensooner.html
Last active July 31, 2025 13:34
A WebAudio Experiment
<!DOCTYPE html>
<html>
<head>
<title>How Soon Is Now? - Interactive Synth</title>
<style>
body { font-family: sans-serif; background-color: #282828; color: #e0e0e0; display: flex; flex-direction: column; align-items: center; }
h1 { font-weight: 300; }
#controls { background-color: #3c3c3c; border-radius: 8px; padding: 20px; margin: 20px; width: 350px; }
.control-group { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
label { font-size: 1em; }
@rsbohn
rsbohn / uncertain.st
Created July 18, 2024 12:26
Scatter Plot Point Event Handler
GtPlotterScatterFocusPointHandler subclass: #DexPointEventHandler
instanceVariableNames: 'chart'
classVariableNames: ''
package: 'uncertain'!
!DexPointEventHandler methodsFor: 'accessing' stamp: 'Dexter 7/18/2024 05:30'!
chart: theChart
chart := theChart! !
!DexPointEventHandler methodsFor: 'accessing' stamp: 'Dexter 7/18/2024 06:11'!
@rsbohn
rsbohn / gist:5c416305971124244c984b4b5836004e
Created June 8, 2024 19:48
Claude implementation for Glamorous Toolkit
Object subclass: #AnthropicClaude
instanceVariableNames: ''
classVariableNames: 'ApplicationKey'
package: 'LLM-AnthropicClaude'!
!AnthropicClaude methodsFor: 'accessing' stamp: 'GlamorousAuthor 6/8/2024 12:25'!
invoke: userPrompt system: systemPrompt
| client payload response |
payload := {#model -> 'claude-3-haiku-20240307'.
#max_tokens -> 1536.
@rsbohn
rsbohn / plan.md
Created June 8, 2024 18:29
Anthropic Claude Plan

Here's a plan to implement support for Anthropic's Claude:

  1. Create a class named AnthropicClaude:

    • This class will encapsulate the necessary functionality to interact with the Anthropic Claude API.
  2. Store the API key and URL:

    • The class should have private attributes to store the API key and the URL for the Anthropic Claude API.
    • These values can be passed as arguments to the class constructor or set using setter methods.
  3. Implement a method to invoke Claude with a prompt and a system prompt:

@rsbohn
rsbohn / ParksOnTheAir.st
Created May 30, 2024 23:39
Parks on the Air API explorer
'From Pharo11.0.0 of 7 March 2024 [Build information: Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)] on 30 May 2024 at 5:33:50.506 pm'!
Object subclass: #SpotList
instanceVariableNames: 'rawData'
classVariableNames: ''
package: 'ParksOnTheAir'!
!SpotList methodsFor: 'accessing' stamp: 'dexter 5/29/2024 15:39'!
rawData: spots
rawData := spots! !
@rsbohn
rsbohn / argmax.st
Created May 24, 2024 20:02
Collection>>argmax
!Collection methodsFor: 'statistics' stamp: 'rsbohn 5/24/2024 13:45:07'!
argmax
"Returns the index of the maximum value in the given collection."
| maxIndex maxValue |
maxIndex := 1.
maxValue := self at: 1.
2 to: self size do: [:i |
(self at: i) > maxValue ifTrue: [
maxIndex := i.
maxValue := self at: i.
@rsbohn
rsbohn / code.py
Created February 25, 2024 18:03
Time and Temperature
# SPDX-FileCopyrightText: Copyright (c) 2024 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
#
# EQUIPMENT
## Adafruit Feather ESP32-S2 TFT
## CircuitPython 9.0.0 or 8.2.9
## FeatherWing Doubler https://www.adafruit.com/product/2890
import board
import displayio
@rsbohn
rsbohn / musicbox.py
Created December 23, 2023 16:53
Plays random notes.
"MusicBox"
# SPDX-FileCopyrightText: 2023 Randall Bohn
# SPDX-License-Identifier: MIT
# Feather RP2040 with speaker on A0
import time
import board
import audiomixer
import audiopwmio
import random
@rsbohn
rsbohn / einkal.py
Created November 23, 2023 14:01
Calendar
# SPDX-FileCopyrightText: 2023 Randall Bohn
# SPDX-License-Identifier: MIT
# a calendar for eInk display
# Blinka but not CircuitPython because of these imports:
from datetime import datetime
from datetime import timedelta
def pad_day(day:datetime) -> str:
"""
Pads a single day with a leading space