221 results for "":
Day 16 (Advent of Code 2022)
Let’s tackle the day 16 puzzle!
Parsing
The input looks like this:
Valve AA has flow rate=0; tunnels lead to valves DD, II, BB
Valve BB has flow rate=13; tunnels lead to valves CC, AA
Valve CC has flow rate=2; tunnels lead to valves DD, BB
Valve DD has flow rate=20; tunnels lead to valves CC, AA, EE
Valve EE has flow rate=3; tunnels lead to valves FF, DD
Valve FF has flow rate=0; tunnels lead to valves EE, GG
Valve GG has flow rate=0; tunnels lead to valves FF, HH
Valve HH has flow rate=22; tunnel leads to valve GG
Valve II has flow rate=0; tunnels lead to valves AA, JJ
Valve JJ has flow rate=21; tunnel leads to valve II
Veronica Mars and NTLM password hashes
Intro
When I started my Patreon, I had no idea if it would work at all. The whole thing seemed like a gamble: spend an inordinate amount of time writing quality articles, and hope that folks will like it enough to kick in 5, 10, or 50 bucks a month just to see more of them.
I’m happy to say the gamble paid off - literally. Take that, impostor syndrome!
Consuming Ethernet frames with the nom crate
Now that we’ve found the best way to find the “default network interface”… what can we do with that interface?
Well, listen for network traffic of course!
use rawsock:: open_best_library;
use std:: time:: Instant ;
fn main () -> Result <(), Error > {
let lib = open_best_library () ?;
let iface_name = format! ( r#"\Device\NPF_{}"# netinfo?
iface = libiface_name?
start =
iface |packet|
start
packet
?
Open sourcing the home CMS
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:
Safer memory-mapped structures
Welcome back to the “Making our own executable packer” series, where digressions are our bread and butter.
Last time, we implemented indirect functions in a no-libc C program. Of course, we got lost on the way and accidentally implemented a couple of useful elk-powered GDB functions - with only the minimal required amount of Python code.
The article got pretty long, and we could use a nice distraction. And I have just the thing! A little while ago, a member of the Rust compiler team stumbled upon this series and gave me some feedback.
rock 0.9.6 is on the loose!
Just 8 days after the last release, rock 0.9.6 is out.
To update, run git pull && make rescue as usual. To install from scratch,
clone the repo, cd into it, and run make rescue from there - it’ll download the latest bootstrap, compile itself from
C, then recompile itself from ooc.
Running rock -V should give you something like this:
rock 0.9.6 codename loki, built on Wed Feb 20 15:09:08 2013
AOT vs JIT: Why don't we do both?
I wanted to take some time to write about a piece of software I’ve been working on lately, just so you know how I’ve been spending the last few weeks.
Rationale
A few years ago, I designed a programming language: ooc. Even though I’ve done my fair share of Java, C, Ruby, JavaScript, and even some Perl, Scala, Python, PHP, etc., I still find myself going back to ooc because it gives me access to C libs, relatively high-level constructs, and it forces me to write code that’s not too smart.
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
My ideal Rust workflow
Writing Rust is pretty neat. But you know what’s even neater? Continuously testing Rust, releasing Rust, and eventually, shipping Rust to production. And for that, we want more than plug-in for a code editor.
We want… a workflow.
Why I specifically care about this
This gets pretty long, so if all you want is the advice, feel free to jump to it directly.