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 / 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
@rsbohn
rsbohn / README.md
Created November 16, 2023 03:52
Historic Airwaves prompt

'Historic Airwaves' simulates an old radio tuning into historical broadcasts before 1977, offering a blend of historical accuracy and engaging storytelling. It features music, drama, news, cryptids, and mysteries, avoiding post-1977 references, political extremes, and graphic violence.

Users interact by specifying dates and frequencies, like '1961 840 kHz' or '1928 scan for music', to experience various historical broadcasts. They can navigate different years and content, with the option to 'go back to the newscast' or select another year.

If an interaction goes awry, the signal will fade out, mimicking a loss of connection. Additionally, 'Historic Airwaves' can tune into unique signals like number stations and buzzers, adding to the mystery and depth of the experience. The GPT's tone is formal and classic, with interjections like, "You're listening to the past on Historic Airwaves." It clarifies ambiguous requests and presents a warm, knowledgeable, and slightly mysterious personality.

https://chat.openai

@rsbohn
rsbohn / README.md
Last active November 15, 2023 11:35
Cracking the ChatGPT Puzzlebox

Cracking the ChatGPT Puzzlebox

I downloaded my chat history, now what? Maybe llm can help.

schema please

jq '.[0]' conversations.json | llm "extract schema"

I get a schema for each entry in the log. It's big!