217 results for "":
Using the Shipyard private crate registry with Docker
Wait wait wait, so we’re not talking about nix yet?
Well, no! The service we have is pretty simple, and I want to complicate things a bit, to show how things would work in both the Dockerfile and the nix scenario.
And because I don’t like contrived examples, we’re going to do something somewhat real-world: we’re going to geo-locate visitors, and track how many visits we get from each country.
Reading files the hard way - Part 2 (x86 asm, linux kernel)
Looking at that latest mental model, it’s.. a bit suspicious that every program ends up calling the same set of functions. It’s almost like something different happens when calling those.
Are those even regular functions? Can we step through them with a debugger?
If we run our stdio-powered C program in gdb, and break on read
, we can
confirm that we indeed end up calling a read
function (which is called
__GI___libc_read
here, but oh well):
The bottom emoji breaks rust-analyzer
Some bugs are merely fun. Others are simply delicious!
Today’s pick is the latter.
Reproducing the issue, part 1
(It may be tempting to skip that section, but reproducing an issue is an important part of figuring it out, so.)
I’ve never used Emacs before, so let’s install it. I do most of my computing on an era-appropriate Ubuntu, today it’s Ubuntu 22.10, so I just need to:
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.
Day 1 (Advent of Code 2020)
I was not planning on doing anything specific this December, but a lot of folks around me (on Twitter, at work) have chosen this Advent of Code to pick up Rust, and I’ve got big FOMO energy, so, let’s see where this goes.
I’ll be doing all of these on Linux, so there may be some command-line tools involved, but don’t worry about them - the code itself should run on all platforms no problem.
Reading files the hard way - Part 3 (ftrace, disk layouts, ext4)
So far, we’ve seen many ways to read a file from different programming languages, we’ve learned about syscalls, how to make those from assembly, then we’ve learned about memory mapping, virtual address spaces, and generally some of the mechanisms in which userland and the kernel interact.
But in our exploration, we’ve always considered the kernel more or less like a “black box”. It’s time to change that.
Day 10 (Advent of Code 2020)
Day, 10! Day, 10!
Okay, Day 10.
Again, the problem statement is very confusing - but what it all boils down to is this. We have a list of numbers:
16
10
15
5
1
11
7
19
6
12
4
To which we need to add 0
and whatever the maximum was, plus three:
16
10
15
5
1
11
7
19
6
12
4
0
22
From there on, if we take them in order, we’ll have gaps of 1 and gaps of 3:
Image decay as a service
Since I write a lot of articles about Rust, I tend to get a lot
of questions about specific crates: “Amos, what do you think of oauth2-simd
?
Is it better than openid-sse4
? I think the latter has a lot of boilerplate.”
And most of the time, I’m not sure what to responds. There’s a lot of crates out there. I could probably review one crate a day until I retire!
One funny way to bundle assets
There’s one thing that bothers me. In part 1, why are we using
hyper-staticfile
? Couldn’t we just use file:///
URLs?
Well, first off: showing off how easy it is to serve some static files, even in a “scary” language like Rust, is just not something I could pass up.
But also: think about distributing salvage
as a tool. Will we want to
distribute all those HTML/CSS/JS/font files alongside it?
Running an executable without exec
In part 1, we’ve looked at three executables:
sample
, an assembly program that prints “hi there” using thewrite
system call.entry_point
, a C program that prints the address ofmain
usingprintf
- The
/bin/true
executable, probably also a C program (because it’s part of GNU coreutils), and which just exits with code 0.
We noticed that when running entry_point
through GDB, it always printed the
same address. But when we ran it directly, it printed a different address on
every run.