The first stable release of Rust was on May 15, 2015, just about 9½ years ago. My first “production” Rust code was a Slack bot, which talked to GoCD to control the rollout of a web app. This was utterly reliable. And so new bits of Rust started popping up. I’m only going to talk about open source stuff here. This will be mostly production projects, with a couple of weekend projects thrown in. Each project will ideally get its own post over the next couple of months. Planned posts Here ...| Random Hacks
I’ve been using the proposed await! and Future features in nightly Rust, and overall, I really like the design. But I did run into one surprise: await! may never return, and has consequences I didn’t fully understand. Let’s take a look. We’re going to use Rust nightly-2019-02-08, and tokio-async-await. This is highly experimental code, and it will require us to convert back and forth between tokio::Future and the proposed std::future::Future. You can find the full code on GitHub. We...| Random Hacks
Lately, I’ve been working on several real-world systems using Rust’s async and tokio. As you can see on the areweasyncyet.rs site, this requires using nightly Rust and the experimental tokio-async-await library. I hope to talk more about these experiences soon! But today, I want to talk about channel APIs in Rust. A question was raised by @matklad on GitHub: I’ve migrated rust-analyzer to crossbeam-channel 0.3, and the thing I’ve noticed is that every .send is followed by .unwrap. Per...| Random Hacks
Want to build your own kernel in Rust? See Bare Metal Rust to get started. We’re almost ready to write a keyboard driver in Rust! But first, we need to deal with two obstacles: setting up the PIC, and handling interrupts without crashing. This is one of the most frustrating steps, as Julia Evans explains in her hilarious and very helpful post After 5 days, my OS doesn’t crash when I press a key: Turn interrupts on (sti). The OS AGAIN crashes every time i press a key. Read “I Can’t Get...| Random Hacks
Want to build your own kernel in Rust? See the Bare Metal Rust page for more resources and more posts in this series. There’s just a few more posts to go until we have keyboard I/O! Hacking on kernels in Rust is a lot of fun, but it can also result in massive frustration when QEMU starts rebooting continuously because of a triple fault. One good way to minimize frustration is to wander on over to the ever-helpful OSDev wiki. It’s sort of like having an experienced kernel developer on hand...| Random Hacks
Want to build your own kernel in Rust? See the Bare Metal Rust page for more resources and more posts in this series. Rust is a really fun language: It allows me to work on low-level kernel code, but it also allows me to wrap my code up in clean, high-level APIs. If you this sounds interesting, you should really check out Philipp Oppermann’s blog posts about writing a basic x86_64 operating system kernel in Rust. He walks you through booting the kernel, entering long mode, getting Rust runn...| Random Hacks
About 15 years ago, I was hanging out at the MIT AI Lab, and there was an ongoing seminar on the Coq proof assistant. The idea was that you wouldn’t have to guess whether your programs were correct; you could prove that they worked correctly. The were just two little problems: It looked ridiculously intimidating. Rumor said that it took a grad student all summer to implement and prove the greatest common divisor algorithm, which sounded rather impractical. So I decided to stick to Lispy lan...| Random Hacks
I’ve been fooling around with some natural language data from OPUS, the “open parallel corpus.” This contains many gigabytes of movie subtitles, UN documents and other text, much of it tagged by part-of-speech and aligned across multiple languages. In total, there’s over 50 GB of data, compressed. “50 GB, compressed” is an awkward quantity of data: It’s large enough so that Pandas can’t suck it all into memory. It’s large enough that PostgreSQL stops being fun, and starts fe...| Random Hacks
I’ve long been a huge fan of Heroku. They’ve made it super easy to deploy and scale web applications without getting bogged down in server administration. Also, their free tier has been very generous, which made Heroku a perfect place to run weekend projects. (And my clients have happily paid plenty of money to Heroku over the years, so nobody’s been losing out.) Heroku’s costs and limitations Lately, the costs of using Heroku for weekend projects have been creeping upwards: Read more…| Random Hacks
Random code snippets, projects and musings about software from Eric Kidd, a developer and occasional entrepreneur.| www.randomhacks.net
ChatGPT turns out to be a surprisingly good pair programmer, despite several false starts.| www.randomhacks.net