TIL: Running `cargo-flamegraph` With Tauri Apps

A Tauri app is just a Rust-compiled binary. But because the Tauri workflow also involves some frontend development you normally develop your app using something like: pnpm tauri dev So when I had to profile my app, it wasn’t immediately obvious how to invoke flamegraph, but it’s really…

TIL: Base64 Encoding an ImageBuffer as PNG(in Rust)

Recently, I had to base64-encode an image::ImageBuffer to send it as a data URL like data:image/png;base64,iVBORw0KGgoAAAANSUhEU... Initially, I tried this: // Cargo.toml image = "0.24.7" base64 = "0.21.5" use base64::{engine::general_purpose, Engine as _}; use image::ImageBuffer; // WRONG:…

TIL: File Uploads Using the Req Elixir Library

The Req Elixir library doesn’t support file uploads(as of version 0.4.5). Instead, you need to use multipart to construct the HTTP request before you send it. Here is an example sending an mp3 file to the OpenAI audio transcription API(aka Whisper): def transcribe_audio(file_…

Project: Try DALLE-3

Recently, I wanted to use OpenAI’s DALLE-3 to generate some images. Surprisingly, I didn’t find an easy way to do this(have OpenAI API set up but no ChatGPT Plus). At least as of right now, OpenAI’s playground doesn’t let you play with DALLE-3. So I…

TIL: Creating `sentence-transformers` Embeddings From Bumblebee

One amazing thing about the Elixir machine learning ecosystem is that you can run state-of-the-art ML models right from Elixir. You can go pick your favorite Hugging Face model and get it running without any ceremony. I was recently creating text embeddings using Bumblebee, and realized that some of the…

Biology:Chemistry :: Chemistry:Physics :: Physics : ??

On the first day of class in eleventh grade, a physics teacher posed the question above to us. He explained that if you look closely enough at a biological process, you’ll see that the “why” is explained by chemistry. Photosynthesis, for example, can be written down as a chemical…

Recently

Reading I’m currently reading Showstopper about the development of Windows NT at Microsoft. I’m not reading any fiction at the moment, but the last novel I read was Pachinko which was a unique historical fiction. I like historical fiction because you pick up some bits of history too,…

Recently

Reading I read “Built to Fail”. It’s about all the things that went wrong at the video-rental company Blockbuster. It reminded me of “Bad Blood”, which is a similar book about Theranos. If you’re into business books, this is a good one. Currently, I’m reading “A Gentleman…