Reading List
The most recent articles from a list of feeds I subscribe to.
Using Zig to Unit Test a C Application
Zig is a new, independently developed low-level programming language. It’s a modern reimagining of C that attempts to retain C’s performance while embracing improvements from the last 30 years of tooling and language design.
Zig makes calling into C code easier than any other language I’ve used. Zig also treats unit testing as a first-class feature, which the C language certainly does not.
These two properties of Zig create an interesting opportunity: Zig allows you to add unit tests to existing C code. You can do this without rewriting any of your C code or build logic.
Using Zig to Call C Code: Strings
Zig is a new, open-source programming language designed to replace C. I’m still a Zig beginner, so I’m trying to learn the language by using Zig to rewrite parts of existing C applications.
One of the first challenges I encountered with Zig is understanding strings. I couldn’t find detailed documentation about how Zig strings work when calling C code, so I’m sharing my findings in case they’re helpful to others who want to use Zig to call C.
TinyPilot: Month 41
New here?
Hi, I’m Michael. I’m a software developer and the founder of TinyPilot, an independent computer hardware company. I started the company in 2020, and it now earns $80-100k/month in revenue and employs six other people.
Every month, I publish a retrospective like this one to share how things are going with my business and my professional life overall.
Highlights
- I had a surprising amount of difficulty offering one-day shipping options.
- I attended the Handmade Seattle conference.
- I experimented with Zig and an open-source AI chatbot.
Goal grades
At the start of each month, I declare what I’d like to accomplish. Here’s how I did against those goals:
Rough Experiments with Llamafile and LLaVA 1.5
I read Simon Willison’s post about using Llamafile to experiment with open-source chatbots / LLMs. He made it sound so easy, so I decided to try it out.
One of my longtime hobby projects is WanderJest, a site for finding live comedy. One of the challenges of that site is that the canonical information about an upcoming show is often the poster for it. Here’s an example:
I’ve been scraping this information by hand, but that’s tedious and time-consuming.
A Simple Example of Calling a C Library from Zig
Zig is a new, independently developed low-level programming language. It’s a modern reimagining of C that attempts to retain all of C’s performance benefits while also taking advantage of improvements in tooling and language design from the last 30 years.
Because Zig is designed to replace C, one of the first-class features is that you can call into C libraries from a Zig application. I couldn’t find any simple examples demonstrating Zig’s C interop functionality, so I decided to write my own.