Recent Posts
Zig and wasm on the command line
Having just read a short post on compiling zig into WASM, I figured I’d attempt the same. Alas, I didn’t find the instructions particularly clear.
First, write a function in zig.
// main.zig export fn addInc(a: i32, b: i32) i32 { return a + inc(b); } extern fn inc(a: i32) i32; now, we compile it:
zig build-lib main.zig -target wasm32-freestanding -dynamic -OReleaseSafe to produce main.wasm.
Let’s wrap this in a script to run it with node:
read more
Litestream, sqlite3 and Rails
Using litestream to deliver robust web app hosting with the performance of embedded sqlite3 seems to be the hot thing right now. It makes sense: for most apps we build today sqlite with backups will perform as well or better than an isolated database like mysql or postgres. The secret is in the fact that the network overhead for each sql query is zero. With sqlite, the database is accesses directly in process.
read more
Simulating bingo for fun
The other day, I was playing bingo with the family. The rules are simple, each person has a 5x5 card with the center number “free”. You pick numbers from 1 to 75 without replacement until some matches 5 in a row on their card (diagonal matches are allowed).
Playing with young kids, I knew there was a clock ticking on how long their attention would last. We had three bingo cards going.
read more