Skip to content

Instantly share code, notes, and snippets.

View johnowhitaker's full-sized avatar

Jonathan Whitaker johnowhitaker

View GitHub Profile
@johnowhitaker
johnowhitaker / fragrances_w_embeddings.json
Created September 25, 2025 20:50
Fragrance database with embeddings
This file has been truncated, but you can view the full file.
@johnowhitaker
johnowhitaker / fragrances_w_embeddings.json
Created September 25, 2025 20:49
Fragrance database with embeddings
This file has been truncated, but you can view the full file.
@johnowhitaker
johnowhitaker / custom.css
Created September 21, 2024 21:21
My Theme (WIP)
div#notebook {
font-family: sans-serif;
font-size: 13pt;
line-height: 170%;
color: #303030;
-webkit-font-smoothing: antialiased !important;
padding-top: 25px !important;
}
body,
div.body {
@johnowhitaker
johnowhitaker / min_p_demo.ipynb
Last active September 16, 2025 03:46
min_p sampling demo for https://youtu.be/GKt5rlDwKNI
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
let context = null;
let canvas = null;
let video = null;
let lastSendTime = 0;
const throttleInterval = 1000; // 1 second in milliseconds
let throttleTimeout = null;
let pendingData = false;
htmx.onLoad(elt => {
// Find and process the canvas element
import requests, json, glob
# Set up
api_key = ...
GPT_MODEL = "gpt-4-1106-preview"
# Read the wordlist and solution from a file
def get_words(idx=0):
files = sorted(glob.glob("connections_data/*.json"))
f = open(files[idx])
@johnowhitaker
johnowhitaker / draw.py
Created June 11, 2024 18:51
Canvas demo direct
from fasthtml.all import *
import anthropic, base64
client = anthropic.Anthropic(
api_key="your_key_here",
)
canvas_js = """
const canvas = document.getElementById('drawingCanvas');
const context = canvas.getContext('2d');
@johnowhitaker
johnowhitaker / draw.py
Last active July 30, 2024 14:45
Canvas demo polling
from fasthtml.all import *
import anthropic, base64, time
client = anthropic.Anthropic(
api_key="your_key_here",
)
canvas_js = """
const canvas = document.getElementById('drawingCanvas');
@johnowhitaker
johnowhitaker / app.py
Created May 30, 2024 21:53
No htmx todo app
from starlette.responses import FileResponse, RedirectResponse
from fastcore.utils import *
from fastcore.xml import *
from fasthtml import *
from sqlite_utils import Database
from fastlite import *
from fastlite.kw import *
db = Database('todos.db')
import requests, json, uuid
from starlette.responses import FileResponse, RedirectResponse
from fastcore.utils import *
from fastcore.xml import *
from fasthtml import *
from oauthlib.oauth2 import WebApplicationClient
# Secrets + URLs