220 results for "":
Lestac: The Making Of
Update: Lestac is now available in Early Access on itch.io! Read more on the official page
So, Lestac is out! Ain’t that something? For those who don’t know, it’s Sylvain and I’s entry for Ludum Dare 28, a video game jam that happens every four months.
Here’s how it looks:
You can play it now if you haven’t yet - it’s available for Linux, OS/X, and Windows. And then you can come back and read this postmortem if you will!
The simplest shared library
In our last article, we managed to load and execute a PIE (position-independent executable) compiled from the following code:
; in `samples/hello-pie.asm`
global _start
section .text
_start: mov rdi , 1 ; stdout fd
lea rsi , [ rel msg ]
mov rdx , 9 ; 8 chars + newline
mov rax , 1 ; write syscall
,
,
"hi there", 10
Day 15 (Advent of Code 2022)
The day 15 puzzle falls into the “math puzzle” territory more than “let’s learn something new about Rust”, but since several folks asked if I was going to continue… let’s continue.
The sample input is as follows:
Sensor at x=2, y=18: closest beacon is at x=-2, y=15
Sensor at x=9, y=16: closest beacon is at x=10, y=16
Sensor at x=13, y=2: closest beacon is at x=15, y=3
Sensor at x=12, y=14: closest beacon is at x=10, y=16
Sensor at x=10, y=20: closest beacon is at x=10, y=16
Sensor at x=14, y=17: closest beacon is at x=10, y=16
Sensor at x=8, y=7: closest beacon is at x=2, y=10
Sensor at x=2, y=0: closest beacon is at x=2, y=10
Sensor at x=0, y=11: closest beacon is at x=2, y=10
Sensor at x=20, y=14: closest beacon is at x=25, y=17
Sensor at x=17, y=20: closest beacon is at x=21, y=22
Sensor at x=16, y=7: closest beacon is at x=15, y=3
Sensor at x=14, y=3: closest beacon is at x=15, y=3
Sensor at x=20, y=1: closest beacon is at x=15, y=3
Cracking Electron apps open
I use the draw.io desktop app to
make diagrams for my website. I run it on an actual desktop, like Windows or
macOS, but the asset pipeline that converts .drawio files, to .pdf, to
.svg, and then to .svg again (but smaller) runs on Linux.
So I have a Rust program somewhere that opens headless chromium, and loads just the HTML/JS/CSS part of draw.io I need to render my diagrams, and then use Chromium’s “print to PDF” functionality to save a PDF.
The perils of ooc arguments
The ooc language is known to be friendly to C libraries, and we have a slew of them covered on GitHub, but one common hurdle is how to correctly declare extern functions.
Argument types
For an ooc function prototype, there are many types of arguments. You can go with regular variable declarations, like so:
something: func (a: Int, b: Int, c: String)
But in this case, a and b have the same type, so you can also use multi-declarations
to shorten it a bit:
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.
The unfair rust quiz really deserves its name. It is best passed with a knowledgeable friend by your side.
Crafting ARP packets to find a remote host's MAC address
Alright. ALRIGHT. I know, we’re all excited, but let’s think about what we’re doing again.
So we’ve managed to look at real network traffic and parse it completely. We’ve also taken some ICMP packets, parsed them, and then serialized them right back and we got the exact same result.
So I know what you’re thinking - let’s just move our way down the stack again - stuff that ICMP packet in an IP packet, then in an Ethernet frame, and then serialize the whole thing.
Productionizing our poppler build
I was a bit anxious about running our poppler meson build in CI, because it’s the real test, you know? “Works on my machine” only goes so far, things have a tendency to break once you try to make them reproducible.
And I was right to worry… but not for the reasons I thought. As I tried to get everything to build in CI, there was a Pypi maintenance that prevented me from installing meson, and then Sourceforge was acting up.
Finding the default network interface through WMI
Let’s set aside our sup project for a while.
Don’t get me wrong - it’s a perfectly fine project, and, were we simply rewriting “ping” for Windows in Rust, we could (almost) stop there.
We’re currently using the operating system’s facility to speak ICMP, which is great for a bunch of reasons: we can be sure that whatever flaws there are in the implementation, all “native” Windows programs suffer from it as well.
Day 14 (Advent of Code 2022)
I like how the day 14 puzzle sounds, because I think it’ll give me an opportunity to show off yet another way to have Rust embedded in a web page.
But first…
Let me guess: parsing?
You bet your furry ass, parsing.
Parsing
The input looks something like this:
498,4 -> 498,6 -> 496,6
503,4 -> 502,4 -> 502,9 -> 494,9
And each line is essentially… a polyline: we’re supposed to draw lines between every point on the path, and that determines rocks on the map.