What are you coding?

I solved 9.2 sometime on Friday.

Right now despite my plans to do more AoC today, I am writing code to write exif / iptc (or whatever) tags into the format that Darktable wants (early attempts had suggested using / for hierarchical tags was fine and now its not.

I also decided to try and hook up my IntelliJ IDE with a local LLM through LM Studio and suddenly I have tons of new GPU driver packages and … am definitely not getting anywhere close to AoC because while the script could be done I am trying to learn to use LM Studio at the same time and…

I think LLMs are really cool. My IDE just downloaded a tiny one specialized on python auto completion … no need for a fat GPU to use that one.

2 Likes

“I’ll just knock up a quick hex coordinate library to support the Talon game software I’ll be writing.”

Half an hour later…

impl Hex {
    pub fn offset(&self, dir: i32, d: i32) -> Hex {
        // offset [d] hexes in [dir], from E clockwise.
        match dir.rem_euclid(6) {
            0 => Hex{q: self.q + d, r: self.r},
            1 => Hex{q: self.q,     r: self.r + d},
            2 => Hex{q: self.q - d, r: self.r + d},
            3 => Hex{q: self.q - d, r: self.r},
            4 => Hex{q: self.q,     r: self.r - d},
            5 => Hex{q: self.q + d, r: self.r - d},
            _ => Hex{q: 0, r: 0}
        }
    }
    pub fn s(&self) -> i32 {
        // the secret hidden S coordinate
        -self.q - self.r
    }
    pub fn add(&self, other: &Hex) -> Hex {
        // sum of two displacements
        Hex{q: self.q + other.q, r: self.r + other.r}
    }
    pub fn delta(&self, other: &Hex) -> Hex {
        // displacement FROM self TO other, other - self
        Hex{q: other.q - self.q, r: other.r - self.r}
    }
    pub fn sub(&self, other: &Hex) -> Hex {
        // displacement FROM other TO self, self - other
        Hex{q: self.q - other.q, r: self.r - other.r}
    }
    pub fn range(&self, other: &Hex) -> i32 {
        // shortest path distance
        let dh = self.delta(other);
        ( dh.q.abs() +
            dh.r.abs() +
            dh.s().abs() ) / 2
    }
    pub fn rotate(&self, steps: i32) -> Hex {
        // rotate [steps] 60degree steps clockwise about (0, 0, 0)
        let ss = steps.rem_euclid(6);
        let mut c = vec![self.q, self.r, self.s()];
        if ss.rem_euclid(2) != 0 {
            c = vec![-self.q, -self.r, -self.s()];
        }
        let offset = ss.rem_euclid(3) as usize;
        Hex{q: c[offset], r: c[(offset + 1).rem_euclid(3)]}
    }
}
5 Likes

And a bit after that, an arc of fire calculator. With tests.

2 Likes

We have logs at work. Lots of logs. It’s not unusual to serve two million page requests in a day.

We have a protocol for doing log analyses. I wrote code for this a few years back. But for example it has to count the number of distinct (IP + user-agent) tuples, and that means they all have to be stored, generally in memory.

These days we have enough traffic that it doesn’t complete a year’s logs even in the 32G of my largest machine.

So I’ve just spent a day or so rewriting it, (a) into Rust so that it runs much faster and uses a bit less memory (even my not terribly ept Rust is about 10× the speed I was getting from Perl) (and, as it happens, it now correctly handles some IPv6 addresses it wasn’t before, because Rust has a good honest 128-bit integer data type and in Perl I have to do it in strings) and (b) with the possibility of a bit of segmentation so that I can do the analyses piecemeal and combine them later.

This is all working Remarkably Well. Hurrah.

6 Likes


This probably means very little. And it’s an absolutely minimum proof of concept. But it is a list of Advantages for a GURPS character, generated directly off the GCA5 file (standard GURPS character management software), entirely in Typst.

This opens the door to writing a full-on GURPS character sheet in Typst. (And the main thing that GCA5 has lacked, to my perception at least, is a character sheet layout as good as the one that a third party wrote for the previous version.)

6 Likes

The final step in this, by the way, was to stop using an actual IP address structure but just put my address categories into a list of (start, end, category ID) (sorted by start, shouldn’t overlap). Which lets me do a binary chop rather than checking each one individually. The entire process is now down to a few minutes.

2 Likes

But today’s Typst has been “take a knitting chart bitmap (like the one below), break it out into a usable data format, and generate a new chart with different colours and various other tweaks”. And the same data will soon generate a text pattern as well.

4 Likes

As mentioned elswhere I have been coding a new project with claude code. I hesitate to call it vibe coding because I am not letting it vibe. I may write down my observances on claude code at some point. I just came here to say that I am working with gradle for the first time and I have regrets of not using it at work … it seems so much faster …

3 Likes

Latest GURPS thing: take a template, randomly expand it into an immediately usable character. (I.e. it does all the “choose X points from trait list Y” choices.) Firedrake/gurps-template-expander: An automatic random expander for GURPS character templates. - Codeberg.org

3 Likes