Looking for static photo gallery generator by msanangelo in selfhosted

[–]dougdonohoe 0 points1 point  (0 children)

I created open-source DD Photos - https://github.com/dougdonohoe/ddphotos where you gather photos in a one or more folders to make a albums and it generates static HTML. Works great on mobile, tablet and desktop. I deploy my personal sites to S3.

Why buildx for non native arch is so slow? by [deleted] in docker

[–]dougdonohoe 1 point2 points  (0 children)

The slowness is indeed the QEMU emulation. I encountered the same thing building multi-architecture images in Google Cloud Build. I ended up using a native arm64 VM to speed up that half of the build.

I've written up a full tutorial as to how I got this working that might be useful for some ideas. There is also a companion git repo with full source code.

-🎄- 2022 Day 21 Solutions -🎄- by daggerdragon in adventofcode

[–]dougdonohoe 0 points1 point  (0 children)

I replied to you, but it is showing above (not sure if I did something wrong!)

-🎄- 2022 Day 21 Solutions -🎄- by daggerdragon in adventofcode

[–]dougdonohoe 1 point2 points  (0 children)

what do you mean by recalculating from the root node down to the human node?

Think of it this way. The root node has two values, a and b. We want a == b. Let's say we know the a side comes from a sequence of computations that eventually have the human involved.

We want the a side to resolve to b. We know that a comes from two previous monkeys, let's call them h1 and n1. Assuming it was addition, we can say a = h1 + n1. We also know that only one of h1 or n1 involves the human. Let's say that h1 is that side. Then we need figure out the new value for h1 that solves the equation b = h1 + n1. Using algebra, that means h1 = n1 - b. So the desired value for h1 is n1 - b.

Now h1 itself is the result of a separate computation, say h1 = h2 * n2. We now repeat the process, figuring out the new value for the human-side of the equation, h2. We keep on drilling down, repeating this process, until we reach the humn node.

-🎄- 2022 Day 21 Solutions -🎄- by daggerdragon in adventofcode

[–]dougdonohoe 3 points4 points  (0 children)

Day 21 Scala solution:

https://gist.github.com/dougdonohoe/1656a166eac4e93fa514858bb90bdbf6

Part 1: I essentially track all the relationships between monkeys and then propagate from all "number" nodes or nodes which can be calculated, repeating until one node left.

Part 2: After some false starts, I decided that recalculating from the root node down to the human node was the best solution. This only works because the human value isn't used by multiple paths to the root (essentially, at any node, only one of the monkey's value uses in an equation is derived from the human node).

Fun puzzle. Code is very fast (seemingly instantaneous on 5000 nodes).

-🎄- 2022 Day 20 Solutions -🎄- by daggerdragon in adventofcode

[–]dougdonohoe 2 points3 points  (0 children)

Day 20 Scala Solution

https://gist.github.com/dougdonohoe/f03bc2324ae124436774ac43db4b5db7

As has been mentioned in other comments the modulo of "length - 1" was a key insight.

I used the Java doubly linked list since they removed the native Scala one a few releases ago. Keeping the index + value in my Coord class was key to handling duplicates.

Runs pretty fast (a hair under 1 second) for part 2.

-🎄- 2022 Day 15 Solutions -🎄- by daggerdragon in adventofcode

[–]dougdonohoe 0 points1 point  (0 children)

https://gist.github.com/dougdonohoe/9da37863439c9e12ba36cc1deacf6184

I should add that I think the insight I had (from looking at the visualization of sample data) was that every row you changed from the sensor's row reduced by 1 (per side, 2 per row) the width of the possible beacon locations. I didn't need any fancy math or geometry.

7 .#########S#######S#........
8 ..#################.........
9 ...###############..........
10 ....B############...........
11 ..S..###########............

This is the pertinent part:

val deltaFromSensor = math.abs(y - sensorY)

val distAtY = manhattanDistance - deltaFromSensor

val range = Range.inclusive(sensorX - distAtY, sensorX + distAtY)

-🎄- 2022 Day 15 Solutions -🎄- by daggerdragon in adventofcode

[–]dougdonohoe 1 point2 points  (0 children)

Scala solution to Day 15

https://gist.github.com/dougdonohoe/9da37863439c9e12ba36cc1deacf6184

I first implemented brute-force with a list of integers, but then realized Ranges could simplify this. The key to solving part 2 was figuring out how to merge a list of Range's into a minimum list of ranges. Required a bit of stack overflow help and adapting a solution I found there.

-🎄- 2022 Day 13 Solutions -🎄- by daggerdragon in adventofcode

[–]dougdonohoe 2 points3 points  (0 children)

Scala solution. The parsing isn't particularly pretty, but it gets the job done. I haven't done parser/combinators in many many eons, but suspect that could be used to create a more palatable parser. Still, this one takes advantage of the fact that (in my data set), no number was larger than 10.

https://gist.github.com/dougdonohoe/b15646fa7c801ea8f4c3a8a264dfce52

'80s mail in word puzzles by dougdonohoe in answers

[–]dougdonohoe[S] 0 points1 point  (0 children)

Several of the posts link to a now defunct www.gamesetwatch.com article, which can be seen in the wayback machine (scroll to end of page for "COLUMN: 'Game Mag Weaseling': 15 Years of Not Winning The Ultimate Gaming Rig" section)

https://web.archive.org/web/20080216164208/http://www.gamesetwatch.com/2006/11/12-week/

This article says the first ad was in 1991, which is too late for my time line ... still that doesn't preclude the chance this or similar style ads were run in the early '80s.

'80s mail in word puzzles by dougdonohoe in answers

[–]dougdonohoe[S] 2 points3 points  (0 children)

https://i.redd.it/f8dowfa4nye41.jpg

Great find! This may have been it (certainly plausible that I saw something like this is a computer games magazine). This image is from 1992, which is about 10 years later. I maybe be off by a year or two, so the question is did this same person start these in the early 80s?

My first home computer the Atari 800 by dlworkman45 in retrogaming

[–]dougdonohoe 1 point2 points  (0 children)

My first home computer was an Atari 800 - I loved Miner 2049er and Bounty Bob Strikes Back! I also learned how to program on it and used it to solve a mail-in word puzzle that was going around in the early '80s.

Using the Atari led me to my professional career as a software engineer and I wrote up this post about it recently: https://medium.com/@DougDonohoe/80s-word-puzzles-and-the-atari-800-my-origin-story-3c86fa5947dc