Toots for walkerb@infosec.exchange account

Written by Walker Boh🛡 on 2025-01-23 at 05:39

Last code of the day.

With the release of the albums feature on Waifuvault, its time to update the SDKs to use it.

Starting with #python - code is done, tests pass, documentation is tomorrow me's fun...

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2025-01-23 at 00:43

The albums feature for Waifuwault is out of PR and into production tonight.

Added the ability to share groups of files accessible with a single url.

A new updated homepage to go with it.

A lot of nice #typescript behind the scenes code in this update.

https://waifuvault.moe

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2025-01-21 at 04:18

Its snowing in Houston tonight...

[#]snow

I'd post a video, but mastodon is being a pain tonight and not uploading.

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2025-01-16 at 05:34

Last code of the day.

The admin page for the new albums feature of Waifuvault is taking shape.

Tripped myself up a bit mistaking C# for #javascript - some of the syntax is close enough its easy to do.

Fun with modals.

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2025-01-15 at 05:35

The last few days have been back to writing real code and not puzzle code.

Adding a new albums feature to Waifuvault. Working with my partner, the backend changes in the #typescript are done (runs on TSED).

Frontend we are working on now and is not my forte, but I'm fairly happy with how this is turning out.

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2025-01-06 at 06:04

Last code of the day.

Todays leet puzzle in #c

Simple.

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2025-01-05 at 18:00

The magic 8 ball at Christmas said "try #ocaml " so I did my usual "hello world" in it - the leibniz algorithm for approximating Pi.

Having to change the normal for loop to a recursive 'emulation' of a for loop because variables are immutable (wut ?) felt very alien...

Hmm.

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2025-01-04 at 05:00

Last code of the evening.

Haven't done a puzzle code since advent of code ended. So jonesing for some dopamine, did todays leet in #c

https://leetcode.com/problems/number-of-ways-to-split-array/?envType=daily-question&envId=2025-01-03

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2025-01-01 at 16:16

[#]happynewyear all

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2024-12-25 at 14:02

Day 25 #adventofcode in the books.

In keeping with tradition this was a fairly simple puzzle, and if you completed part 1, and had all of the other stars then you got the star for part 2 automatically.

You were given a number of grids, some representing 'locks' and some representing 'keys'. You had to figure out the number of combinations of locks and keys that could be overlaid on one another without any columns overlapping.

Scanned each in and converted it to a set of heights from the top if it was a lock or the bottom if it was a key. Then simply checked each key against each lock. Simple.

Typescript for this last one, making three languages used throughout the competition - #typescript #python and #c

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2024-12-25 at 06:26

2024 #adventofcode completed.

Mostly used #typescript , with a few done in #python and one done in #c

Merry Christmas all 🎅

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2024-12-24 at 17:16

Day 24 #adventofcode in the books.

You were given a definition of a somewhat large logic circuit, and its inputs.

Part 1 was simulating the circuit and finding out what the outputs were. This was very similar to Day 7 2015, so I used the same technique - convert the "gates" to code and using eval on the list and looping till all of the output variables were defined. Worked swimmingly.

Simple. That was the feint. With part 2 the punch landed.

Part 2 you are told the circuit is an adder and four of the gates were wrongly configured, and you had to find out which inputs needed to be swapped to fix the adder.

Looked at simple brute force (iterate, try see if it fixed the adder), but turns out there are 10**19 combinations if you just do everything.

With some heuristics like it being in the path of an output, and on different paths I got that down to a paltry 260 million, but that still blew out the memory on the stack.

FINE.

Lets go work out how hardware adder works. Found a definition for a ripple adder that looked good. Created a set of integrity checks based off that and applied it to the list of gates. That worked.

[#]typescript got in the way a little in part 1 (#python would have been easier as looser variable def rules) but was great for part 2.

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2024-12-23 at 15:08

Day 23 #adventofcode in the books.

You were given a network of nodes (computers in the story).

Part 1 was finding all the collections of three nodes that were were fully interconnected and contained at least one node whose name started with 't'. For this I scanned each nodes links and looked for any that connected to each other.

Part 2 was finding the largest collection of collected nodes, and then using the sorted list of their names as a password. For this I did a similar thing, looking for nodes whose links also linked to most of the same targets. Then filtered that for nodes that were in all of the returns.

I cost myself a hour though by not reading the question. The password had to be node names joined with commas not just node names joined...

[#]typescript worked well for this.

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2024-12-22 at 15:34

Day 22 #adventofcode in the books.

Part 1 was to apply a convoluted mutator function to a (large) set of given numbers 2000 times and then sum the results.

My first thoughts on seeing this were "thats a lot of compute" and "looks like a factorial again...", so I memoized the mutator function. Memoization is just a fancy way of saying "cache previous results".

This worked.

Part 2 was to then extract the last digit (the 'price') of each of the 2000 generated codes for each of the initial codes, and then extract the changes in price between each set of prices.

Finally you had to find the four consecutive changes that preceed the maximum you could extract from the price matrix based on it.

Again this sounded like a lot of repetitive compute, so I memoized the summing function.

Even memoized it took 3 minutes to run, but worked.

As I was working with #typescript and the initial codes were already large, I preemptively went bigint. Not 100% sure it needed it, but I didn't want to find out the hard way I was wrong.

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2024-12-21 at 16:32

Day 21 #adventofcode in the books.

Part 1 was to figure out the minimum move sequence to input a code on keypad, with the wrinkle being there were three other keypads above it before the movement was applied to the final keypad.

I wrote a BFS pathfinder for the keypads and then used it to derive all of the minimum paths and use that to find the min length on the first keypad.

Except it would have taken 10 hours to complete. By this point it was headed for 2am and I decided to take the slot machine route and write a bogo function (IE choose a random code at each level and just try that to see if you get lucky). Yeah thats when I knew it was time to pack it in for the night.

Epiphanies I had in the shower this morning:

  1. Its basically a weird movement factorial. Factorials respond well to being memoized. So I memoized it.

  1. BFS pathfinding on the keypad was massive overkill. You could reduce it to simple linear combinations of x and y movements.

After a complete rewrite taking those into account it finished in milliseconds.

Part 2 took it to stupid levels by making it 25 levels deep. But as luck would have it the way I rewrote my code made this an easy extension.

The only wrinkle here was the sheer size of the number it returned needed a bigint.

Don't know that #typescript was the best for this one, would probably have been easier in #python

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2024-12-20 at 20:45

Day 20 #adventofcode in the books.

Yet more grid path finding. This time a variant on finding better paths by removing a set amount of obstacles.

Part 1 was removing one obstacle at any given point, and summing up the amount of paths which showed a set amount of improvement.

The wording of the questions this year has been made deliberately strange - I assume to defeat AI, but its proving difficult for I too. For two hours I fought thinking it meant removing two obstacles.

Part 2 upped the ante to 20 obstacles. I had to change my approach from part 1 fairly drastically to get this to work.

[#]typescript worked well for this.

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2024-12-19 at 15:00

Day 19 #adventofcode in the books.

You were given a set of strings and tokens and you had to find out which of the strings could be made from the tokens.

Sounds simple right ? Except the tokens are variable lengths and some of the longer tokens can be contained in constructs of the shorter ones, so simple check/replace is out...

Tried a few different things before I came to a recursive solution, that worked but was too slow for the real data.

So it was time to break out DP.

Converted the algo from recursive to DP and it worked.

Part 2 was counting the variations of tokens that could make the strings up.

This was a simple modification to my existing code.

[#]typescript performed admirably for this.

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2024-12-18 at 14:53

Day 18 #adventofcode in the books.

After a run of brutal part 2s for the past few days, this was a softball by comparison. You were given a blank grid, and a list of obstacles to be added.

Part 1 was finding the shortest path after applying 1024 obstacles to the grid. Dijkstras made short work of this.

Part 2 was finding the position of the first obstacle that completely blocked the grid making escape impossible. In my original pathfinder I had set it to return -1 if it could not find a path, so this was simply loop the addition of the obstacles till you hit -1.

No bigint issues with #typescript this time 🤣

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2024-12-17 at 18:43

Day 17 #adventofcode in the books.

Part 1 was to create a virtual machine to execute a given program and get back a list of numbers. Simple.

Part 2 was to reverse it and from a given list, get the initial value number.

I decompiled the program and figured out a reasonable starting point for brute force forward attempts. However I realized this was futile, even knowing a decent start point there were way too many combinations.

Went back to the drawing board and hit on the idea of working backwards on each digit (the next step on each was a power of 8 higher). Worked for the short test code. Failed for the real one.

Tried many variations. Came back to it this morning and coverted it to #python as a I suspected the numbers might be getting large. That worked. The factors had gotten beyond the max safe int in #typescript

=> View attached media

=> More informations about this toot | View the thread

Written by Walker Boh🛡 on 2024-12-16 at 18:17

Day 16 #adventofcode in the books.

Finding a minimum path through a large maze.

Part 1 was finding the cost of the minimum cost path. My first approach of BFS worked fine on the smaller test mazes, but never finished on the full size one.

I had tried to avoid it because I hate it, but it was time to use Dijkstras algorithm. That worked.

Part 2 was adding up all of the unique tiles visited for all of the paths that were minimum cost. This bent my brain for a while, trying to reverse it from the DP matrix was an exercise in futility.

Came back to it with a fresh approach this morning and recorded each of the unique parent tiles and costs as I went, then used that at the end to reverse the paths out. That worked.

[#]typescript handled all of this just fine.

Ouch again - I still hate dijkstras...

=> View attached media

=> More informations about this toot | View the thread

=> This profile with reblog | Go to walkerb@infosec.exchange account

Proxy Information
Original URL
gemini://mastogem.picasoft.net/profile/109298192802195567
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
450.2411 milliseconds
Gemini-to-HTML Time
7.768008 milliseconds

This content has been proxied by September (ba2dc).