audrey.feldroy.com

The experimental notebooks of Audrey M. Roy Greenfeld. This website and all its notebooks are open-source at github.com/audreyfeldroy/audrey.feldroy.com

# Get a Jupyter Notebook Filename From Itself

Tue, Apr 8, 2025

When working in notebooks, you'll occasionally need to access the notebook's own filename. Here's code to do it, which I've verified works in Jupyter Notebook Classic.

# Pi

Fri, Mar 14, 2025

Happy Pi Day. Here's pi from the stdlib math module and from Numpy.

# Building a Better Title-Caser, Part 1: Beyond Python str.title

Fri, Feb 14, 2025

Title-casing text is one of those hard problems no one ever gets right, yet no one considers worthy enough to solve with AI. Here I experiment to see if I can improve upon the latest best solutions with a local Ollama modelfile and a solid prompt.

# Excavating a Lost CLI Tool

Thu, Feb 13, 2025

I thought I had completely lost my new iteration on my notebook titler tool, but it turns out I'm finding bits and pieces in various places. Here I try to put it together again.

# An Informationally-Dense Index Page

Sun, Feb 9, 2025

Now that I have a lot of notebooks, it would be nice to have a more compact index page. I want to see more of my posts from mobile all at once. I'm going to prototype it in Tailwind.

# Create a CLI Tool With fastcore.script

Wed, Feb 5, 2025

Fastcore's call_parse decorator turns Python functions into CLI tools quickly. It's nowhere near as fancy as Typer or Click, but it's super quick to use.

# Text Embeddings and Cosine Similarity

Sun, Feb 2, 2025

I use Gemini's text-embedding-004 model to generate embeddings for sentences. Then I define a cosine similarity function and see what it returns for a few related and unrelated sentences.

# Troubleshooting MonsterUI on This Site

Thu, Jan 23, 2025

My first MonsterUI notebook wasn't rendering correctly. I started to debug it in this notebook, but ended up just using this as a test notebook for the next one.

# Genanki and fastcore

Sun, Jan 19, 2025

Working with Anki flashcard decks in Python, with genanki to work with the decks and fastcore for ease of use.

# Alarm Sounds App

Sat, Jan 18, 2025

Demo of adding sounds to a FastHTML app with Tone.js. Sounds make web apps come alive and feel interactive.

# Alarm Clock Sounds

Fri, Jan 17, 2025

FastHTML MonsterUI example app that uses Tone.js to make different alarm clock sounds.

# SQLite FTS5 Tokenizers: `unicode61` and `ascii`

Mon, Jan 13, 2025

The SQLite FTS5 (full-text search) extension includes the built-in tokenizers unicode61, ascii, porter, and trigram, implemented in [fts5_tokenize.c](https://github.com/sqlite/sqlite/blob/master/ext/fts5/fts5_tokenize.c). [APSW](https://github.com/rogerbinns/apsw) provides a Python API to use those. Here we explore the default tokenizer `unicode61` and built-in tokenizer `ascii` in detail.

# A Better Notebook Index Page

Sun, Jan 12, 2025

I've made good progress on creating a notebook every day. Now I have so many notebooks that my index page needs an overhaul, including: * Dates with datetime * Cards with execnb to grab notebook titles * The cache decorator to make that fast * Subtle CSS tweaks to increase information density

# NBClassic Keyboard Shortcuts: Command and Dual-Mode

Sat, Jan 11, 2025

I'm taking inventory of all the Command Mode and dual-mode nbclassic keyboard shortcuts on macOS, with my random musings about each. This is part of my deliberate practice to master all of the useful ones, and will serve as a reference for myself later.

# Understanding FastHTML Routes, Requests, and Redirects

Fri, Jan 10, 2025

In this tutorial we'll look at the simplest routes and route handlers you can create with FastHTML. We'll define the handlers as little functions, and then call them as we would any other Python function. After that, we'll make simple GET requests to a simple index route/handler, a parameterized one, and a parameterized one with a redirect.

# HTML Title Tag in FastHTML

Wed, Jan 8, 2025

I get so lazy about title tags. The point of today's notebook is to make me less lazy, so I actually fix the title of this site. Oh, and to explore `Title` and `Titled` in FastHTML.

# Understanding FastHTML Headers

Mon, Jan 6, 2025

FastHTML provides default headers for every page, which are also fully customizable. This notebook explores how this works.

# Using SSH Agent to Save Passphrase Typing

Sun, Jan 5, 2025

In my terminal (Ghostty) when I run shell scripts that update multiple repos, I get asked my SSH key passphrase over and over. It gets annoying with 20+ repos. To get around this, I use OpenSSH's authentication agent, `ssh-agent`.

# Using zip

Fri, Jan 3, 2025

The [zip docs](https://docs.python.org/3/library/functions.html#zip) say that `zip(*iterables, strict=False)`: > Iterate over several iterables in parallel, producing tuples with an item from each one.

# FastHTML Piano, Part 2

Thu, Jan 2, 2025

from fastcore.all import * from fasthtml.common import * from fasthtml.jupyter import * from IPython.display import display, Javascript

# FastHTML Piano, Part 1

Wed, Jan 1, 2025

My adaptation of https://developer.mozilla.org/en-US/play to FastHTML, with improvements.

# Note Box FastTag

Tue, Dec 31, 2024

I needed a quick note box for the index page of this site, without affecting the CSS of my notebooks that explore weird CSS stuff deeply.

# Minimal Typography for FastHTML Apps

Sat, Dec 28, 2024

When using `pico=False` and no CSS framework, a FastHTML page doesn't look great. Can we use minimal typography to make it look decent, without dependencies?

# How I Fixed CSS Scope Leakage in Pygments Syntax Highlighting

Fri, Dec 27, 2024

This notebook shows how to: * Get and use Pygments styles programmatically * Extract and display the source code from Python functions * Apply different Pygments syntax highlighting to different cells of the same notebook with proper CSS scoping * Use Pygments-highlighted code in a FastHTML FastTag

# Converting Jupyter Notebook Cells to Pygments Syntax-Highlighted HTML

Wed, Dec 25, 2024

## Understand the Problem Can a Jupyter notebook be converted to syntax-highlighted HTML easily with Pygments? Side note: Highlight.js is what Danny and Isaac use for syntax highlighting in FastHTML apps. I'll try that in another notebook later. I started this on a plane where I only had Pygments installed.

# What Can `execnb` do?

Tue, Dec 24, 2024

This notebook is a [SolveIt](https://solveit.fast.ai/)-style exploration of [https://github.com/AnswerDotAI/execnb/](https://github.com/AnswerDotAI/execnb/). Here I am following the SolveIt process in a Jupyter notebook to learn new things.

# Daddy's Snowman Card

Mon, Dec 23, 2024

Here we are checking the numbers from our daughter's snowman card to Daddy. She gave him math problems to solve and a snowman joke.

# Using Claudette with FastHTML

Mon, Aug 5, 2024

import os from claudette import * import fasthtml import fasthtml.common from fasthtml.common import * import inspect

# Claudette

Sun, Aug 4, 2024

Studying https://claudette.answer.ai/

# Delegates Decorator

Mon, Jul 29, 2024

My study of the `@delegates` decorator and `GetAttr` from `fastcore`.

# Auth in FastHTML

Mon, Jul 29, 2024

My early attempts to figure out auth in FastHTML. Things have likely changed a lot since.

# SemanticUI FastHTML Cards

Sun, Jul 14, 2024

Caution: I’ve learned better patterns since I wrote this. Leaving this here for posterity.

# Setting Up a Blog With nbdev

Sat, Jul 29, 2023

I feel like Jupyter notebooks would be really nice for blogging or publishing "Today I Learned" posts. I had heard about Fastpages before via Jeremy Howard's blog or YouTube videos, but seeing that it was deprecated in favor of nbdev, I decided to try nbdev.

© 2024-2025 Audrey M. Roy Greenfeld