fogbound.net




Tue, 14 Nov 2023

My Geometry BS, revisited

— SjG @ 7:14 pm

So, back in January, I posted about being back on my BS with geometry programs. Not too long after that, I think, I got distracted and changed focus and didn’t work on the code at all.

Well, in keeping with the idea that it’s better to do something half-assed than not do it at all, I’ve posted the code, such as it is. It’s a kaleidoscope-like thing written in Javascript, and outputs in SVG for all your re-use needs.

The programs flaws are many. It uses only line segments, not splines, so curves are not smooth. It doesn’t actually merge the line segments into continuous shapes, so the resultant SVG files are huge. And it’s written in Javascript, so in addition to all the mistakes I’ve made, it’s got bugs that may not even be mine.

Still, I think it’s fun to play with. Maybe one day, I’ll write code to merge the line segments, and possibly weave overlapping lines into knot patterns (which was the original intent). But for now, here it is: Tiler.


Tue, 10 Oct 2023

Which files are dupes

— SjG @ 4:56 pm

Over the past six months, I’d copied a set of files down from a network drive, then new ones were added to the network drive, and I’d copied some of the new ones down but maybe not all? How could I possibly clean up this mess?

Easily, it turns out!

$ diff -srq /mnt/Volumes/2023/Bank_Statements/ /local/receipts/2023/

This will list all the files, and mark if they’re only in the /mnt/Volumes/2023/Bank_Statements/ directory, only in the /local/receipts/2023/ directory, if the file exists in both places but is different, or if the file exists in both places and is identical. The -s flag means “report identical files,” the -r flag is to go recursively, and the -q flag just announces the files are the same/different rather than showing their differences.

This’ll work as long as the file names have not been changed. If file names have changed, it’ll require a more robust utility.


Mon, 18 Sep 2023

Borderline

— SjG @ 12:21 pm

When designing visual stuff, I often would like the ability to create a patterned frame for whatever it is I’m doing. It’s not so much work to drag and move image tiles around to make a nice frame, but I wanted to make it easier.

Thus “Borderline” was born. It’s a JavaScript tool for laying out tiles into frame designs, with a few automated features to make playing around easier.

Borderline lets you arrange small SVG files to form a border. It optionally does some rotational and mirroring transforms to make the pattern look nice.

It includes a small collection of custom, original SVG tiles to use for making nice borders. You can also “upload” your own! (since this all takes place in your browser, nothing actually gets uploaded to a server or leaves your local machine).

Once you’re happy with your design, you can export the entire border as an SVG suitable for printing or modification in your favorite vector graphics application.

You should be able to use just about any SVG file as a tile, although if it’s too big or complicated your browser may run out of memory and behave badly.

You can try it here: Borderline. Source is available at Codeberg.


Mon, 21 Aug 2023

Another “sed” one-liner

— SjG @ 1:22 pm

I needed to generate a comma-delimited, quoted list of all the .svg image files in a directory, but without the extension.

This worked:

ls -1 ./svgs | sed 's/.*/"&"/' | sed 's/\.svg//' | paste -sd, -

Hooray for the command-line!

(coming soon, why I needed that list…)

Filed in:

Wed, 14 Jun 2023

pamd running out of sessions for cron

— SjG @ 6:51 am

I manage a very busy Rocky Linux test-server. For one staging environment, cron is already running five or six maintenance scripts every minute. But when the tests run, the system has to do a lot of additional permissions fixes and filesystem adjustments. I’ve started seeing in the logs the following error message:

pam_systemd(sudo:session): Failed to create session: Maximum number of sessions (8192) reached, refusing further sessions

Now, there is a known older problem with systemd and dbus, that comes up when you search for this error message. I couldn’t find any concrete actions I could take to fix the issue. The other major search results are RedHat pages behind their subscription wall, and, at this point I’m apparently too dumb and out of date to even be able to figure out how to pay for a RedHat subscription.

I think I’ve found at least a temporary solution, however. In /etc/systemd/logind.conf there is the SessionsMax field where you can override the default. I doubled it to 16384, then ran systemctl restart systemd-logind

I’ll have to see if that’s a viable long-term fix rather than just treating the symptoms of a bigger issue.