I wrote a little library that estimates token usage for the OpenAI chat API. You can find it on GitHub and npm , but if you want to know why I built it, read on! Why count tokens? It’s important to use your precious LLM context window effectively. Even though context windows are getting bigger, shorter prompts cost less, leave more room for the completions, and seem to perform better. When you’ve…
I use Kopia to back my Mac up to the cloud. It’s fast, open-source, flexible, and the best part is that it’s costing me a mere $0.26 per month for 20GB of data. Kopia takes incremental snapshots of directories of my choosing, and I’ve configured it to store my backups in Backblaze’s B2 service. Content is intelligently deduplicated, which makes taking new snapshots fast and space-efficient. B2’s…
If you read the title and thought “well, you were probably just doing something silly beforehand”, you’re right! But what is programming if not an exercise in making silly mistakes? Tracking down silly mistakes is where all the fun is to be had! I’ll also state the usual benchmarking caveat up front: the 1.7x speedup was measured while running the program on my data on my computer, so take that…
stdbuf(1) is a little command line utility that changes how a program buffers its standard input or output streams. It sometimes doesn’t work as expected, so I became curious about what was going on under the hood. A quick stdbuf primer I mostly use stdbuf to flip a program’s stdout stream to be line buffered so I can see its output more quickly. It’s common for stdout to use a fixed-sized buffer…
Vitals is a little Mac app I built recently that shows you which programs are slowing your computer down. It lives in the menu bar, keeping track of resource usage in the background, so you can summon it instantly at the click of a button. While other tools like Activity Monitor show you each process’ current CPU usage, Vitals shows a per-process CPU graph covering the last 60 seconds. This makes…