220 results for "":
Rust modules vs files
A while back, I asked on Twitter what people found confusing in Rust, and one of the top topics was “how the module system maps to files”.
I remember struggling with that a lot when I first started Rust, so I’ll try to explain it in a way that makes sense to me.
Important note
All that follows is written for Rust 2021 edition. I have no interest in learning (or teaching) the ins and outs of the previous version, especially because it was a lot more confusing to me.
Day 12 (Advent of Code 2022)
Alright! The day 12 puzzle involves path finding, and it seems like a good time to lean more heavily on the WASM embeds I’ve set up for the previous parts.
Let’s start by setting up the types we’ll want!
Types and parsing
Our input is a heightmap, like so:
Sabqponm
abcryxxl
accszExk
acctuvwj
abdefghi
Where 'a'..='z' is a square with a given elevation (from lowest to highest),
S is the start, and E is the end.
In the bowels of glibc
Good morning, and welcome back to “how many executables can we run with our custom dynamic loader before things get really out of control”.
In Part 13, we “implemented” thread-local storage. I’m using scare quotes because, well, we spent most of the article blabbering about Addressing Memory Through The Ages, And Other Fun Tidbits.
But that was then, and this is now, which is, uh, nine months later. Not only am I wiser and more productive, I’m also finally done updating all the previous thirteen parts of this series to fix some inconsistencies, upgrade crate versions, and redo all the diagrams as SVG.
Huffman 101
Let’s play a game: your objective is to guess a word, but you can only ask yes or no questions. You should also aim to ask as few questions as possible.
You might have played a variant of this game before, guessing famous actors or musicians. You’d usually ask questions like “Are they alive?”, or “Have they won an Oscar”? And that would allow you to narrow down the possibilities, until you finally resort to a list of direct guesses (“Is it Amy Adams?”) or simply give up.
Async fn in trait, for real this time
async_trait’s one weird type ascription trick
Now that I got the Log in with GitHub feature working, let’s explore
what this would’ve looked like with the async_trait crate.
First up, the trait definition:
/// Something that can refresh credentials
# [ async_trait :: async_trait ]
pub trait CredentialsRefresher {
async fn refresh ( & self , creds -> eyre
A short (and mostly wrong) history of computer networking
When I launched my Patreon, I vowed to explain how computers work. But in 2019, computers rarely work in isolation. So let’s take the time to write a few articles about how computers talk to each other.
The history of network protocols and standards is long and complicated. Starting with a comprehensive review would prove quite tedious, especially if such a review was done in isolation from modern use.
Day 3 (Advent of Code 2022)
Part 1
I’m not sure where the day 3 challenge is going, because the problem statement for the first part is kinda convoluted.
As usual we have an input, like this:
vJrwpWtwJgWrhcsFMMfFFhFp
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
PmmdzqPrVvPwwTWBwg
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
ttgJtRGJQctTZtZT
CrZsJsPPZsGzwwsLwLmpwMDw
Each line represents the contents of a “rucksack”, divided in two halves (which are called “compartments”), so for line 1:
The iterative nature of art
Things I struggle with
Putting thoughts in bits
I think about lots of things but when it comes down to writing them, drawing them, implementing them, it’s not that easy. Even with years of practice in each of these trades, it’s still an uphill battle.
Which is why I am not going to read that article after I wrote it and will go straight to publication.
Not assuming nobody cares
The many rewrites of the itch.io desktop app
I started working on the itch.io desktop app over 4 years ago.
It has arguably been my main project ever since, along with companion projects like butler, capsule and many smaller libraries.
I’m fuzzy on the initial history, but I remember the codebase went through a lot of changes. As early as 2014, the whole codebase was ported from vanilla JavaScript to TypeScript. In 2016, I released a timeline of all the changes. In 2018, I released a postmortem for v25 (which I then deleted).