219 results for "":

Day 17 (Advent of Code 2022)

Advent of Code gets harder and harder, and I’m not getting any smarter. Or any more free time. So, in order to close out this series anyway, I’m going to try and port other people’s solutions from “language X” to Rust. That way, they already figured out the hard stuff, and we can just focus on the Rust bits!

Sounds good? Good. Let’s proceed.

Making a dev shell with nix flakes

In the previous chapter, we’ve made a nix “dev shell” that contained the fly.io command-line utility, “flyctl”.

That said, that’s not how I want us to define a dev shell.

Our current solution has issues. I don’t like that it has import <nixpkgs>. Which version of nixpkgs is that? The one you’re on? Who knows what that is.

Also, we haven’t really seen a mechanism to use .nix files from elsewhere.

Day 2 (Advent of Code 2022)

Part 1

In the day 2 challenge, we’re playing Rock Papers Scissors.

We’re given a strategy guide like so:

A Y B X C Z

Left column is “their move”: A means Rock, B means Paper, C means Scissors. Right column is “our move”: X means Rock, Y means Paper, Z means Scissors.

Each line corresponds to a turn, and we must calculate the total score we get. Picking “Rock” gives 1 point, “Paper” gives 2 points, and “Scissors” gives 3. Losing the round gives 0 points, drawing gives 3, winning it gives 6.

Day 9 (Advent of Code 2020)

Day 9’s problem statement is convoluted - the “ah maybe that’s why I don’t usually do Advent of Code” kind of convoluted, but let’s give it a go anyway.

So, we have a series of numbers, like so:

35 20 15 25 47 40 62 55 65 95 102 117 150 182 127 219 299 277 309 576

And uh the first N numbers are a “preamble” and every number that comes after that must be the sum of any two of the numbers that come before it.

Catching up with async Rust

In December 2023, a minor miracle happened: async fn in traits shipped.

As of Rust 1.39, we already had free-standing async functions:

pub async fn read_hosts() -> eyre::Result<Vec<u8>> { // etc. }

…and async functions in impl blocks:

impl HostReader { pub async fn read_hosts(&self) -> eyre::Result<Vec<u8>> { // etc. } }

And now for a bit of an announcement

Hey all, thanks for checking in!

After much soul searching, I have arrived to the following conclusion:

  • Teaching folks about stuff is my jam.

I’ve been writing multiple articles that sort of read like course material, if there was no dress code, maybe?

In 2013, I organized a 1st year Computer Science student project. Instead of making them implement “control tower software” for a fictional airline, I decided to go for something real - the BitTorrent protocol.

An ooc quine

While preparing my next post about ooc documentation yet again, I stumbled upon an old ooc quine of mine. Here it is in integrality for your pleasure:

q := 34 as Char l := [ "q := 34 as Char" "l := [" "]" "for (i in 0..2) {" " l[i] println()" "}" "for (i in 0..12) {" " q print(); l[i] print(); q println()" "}" "for (i in 2..12) {" " l[i] println()" "}" ] for (i in 0..2) { l[i] println() } for (i in 0..12) { q print(); l[i] print(); q println() } for (i in 2..12) { l[i] println() }

Futures Nostalgia

Up until recently, hyper was my favorite Rust HTTP framework. It’s low-level, but that gives you a lot of control over what happens.

Here’s what a sample hyper application would look like:

$ cargo new nostalgia Created binary (application) `nostalgia` package
$ cd nostalgia $ cargo add hyper@0.14 --features "http1 tcp server" Updating 'https://github.com/rust-lang/crates.io-index' index Adding hyper v0.14 to dependencies with features: ["http1", "tcp", "server"] $ cargo add tokio@1 --features "full" Updating 'https://github.com/rust-lang/crates.io-index' index Adding tokio v1 to dependencies with features: ["full"]

Engineering a Rust optimization quiz

There are several Rust quizzes online, including one that’s literally called the “Unfair Rust Quiz” at https://this.quiz.is.fckn.gay/, but when I was given the opportunity to record an episode of the Self-Directed Research podcast live on the main stage of EuroRust 2025, I thought I’d come up with something special.

Question Misc 6 of the unfair Rust quiz, about drop order.

The unfair rust quiz really deserves its name. It is best passed with a knowledgeable friend by your side.

rock 0.9.7 + new website

This is going to be a short one.

Basically, since February, both shamanas, fredreichbier and I have putting way too much work into the latest iteration of rock, an ooc compiler written in ooc.

I have the pleasure to announce that version 0.9.7, codename pacino is now out, as you can plainly see on the new website: https://ooc-lang.github.io

You can read the release notes to learn what has changed, but basically expect a lot of fixes, some new APIs, and awesome backtraces.