Mac Icons for PDFs

I have a great many folders of PDFs, mostly grabbed from archive.org magazine_rack, ataribooks, etc. The trouble is when I open a folder of these, Finder makes preview icons for a few of them, then gives up and they all show a generic "PDF" icon. What I want is a persistent icon for the first page!

First, you need osxutils:

% sudo port install osxutils
% man seticon

And my icontool.

sips (Scriptable Image Processing System) is a built-in tool on the Mac, incredibly powerful image converter. I'm not gonna do anything fancy, just use it to get an image.

Now create pdficonset.zsh:

#!/bin/zsh
export CG_PDF_VERBOSE=1

iconify () {
    echo $1
    sips -s format png -z 1024 768 -p 1024 1024 $1 -o thumb.png && \
    icontool.zsh thumb.png thumb.icns && \
    seticon -d thumb.icns $1
    rm -f thumb.png thumb.icns
}

if [[ $# -eq 0 ]]; then
    ls -1 *.pdf |while read -r f; do
        iconify $f
    done
elif [[ "$1" == "-r" ]]; then
    find . -type f -d -iname "*.pdf" |while read -r f; do
        iconify $f
    done
else
    while [[ $# -gt 0 ]]; do
        iconify $1
        shift $1
    done
fi

Now run it:

% pdficonset.zsh
# iconifies pdfs in current dir
% pdficonset.zsh -r
# iconifies pdfs in all subdirs
% pdficonset.zsh foo.pdf
# iconifies named pdfs

Boom! All nice icons.

[update: added a little better error-safety. CG_PDF_VERBOSE just gives better but still not useful error messages.]

[update 2023-12-21: finally made it generate proper aspect ratio icons, and multiple file commands.]

I don't have the problem as bad with CBZ/CBR comics; they'd be trivial to extract the first page from, since they're just ZIP/BZIP files.

folder full of pdfs with nice icons instead of placeholders

Nintendo Direct 2022-02-09

  • Nintendo Direct is all Switch games today, which is good, that's the only console I care about anymore.

What's annoying is, since Nintendo have stated Animal Crossing New Horizons has had its last update (tho they keep doing minor patches so far; and anyway I only check in once a week or so now), there's not really a strong reason to watch these. But maybe I'll find a new crack addiction?

  • Fire Emblem Warriors: So, Fire Emblem Heroes (iPhone/Android) is a gacha game with very simplified tac-RPG combat. Bored the hell out of me, tries to extract money by making you click on a bunch of things to get coins. Fire Emblem: Three Houses is a semi-open-world-y RPG with a tactical combat system, but a lot of detail to it; I haven't played, but it looks competent. Fire Emblem Warriors is a dumb action beat-em-up in the same setting, with pompous stage-acting voiceovers that I don't think I could take seriously long enough to reach the next fight. Pass, but looks competent for the kind of junk game it is.
  • Advance Wars, Splatoon, Front Mission: Remake/sequels of lame games. Front Mission in particular A) Calls the mecha "wanzers", B) is all about aiming at a guy's nuts. No.
  • No Man's Sky: Yeah, sure. Been a little jealous of other devices that can run it, but not enough to get one, for years now. Gnome Anne's Ky is finally on a usable device. My experience with Quake, Skyrim, etc. on it is that FPS things can work on Switch, but they're awkward, but Nermanski is slow and awkward anyway so it should be fine. Summer.
  • Mario Strikers Battle League: Weirdly Soccer-like, but not: A) Soccer doesn't allow use of hands, Bowser is disqualified. B) Why are they wearing helmets? There's no helmets in Soccer and they're cartoon characters anyway, head injuries aren't a problem. C) They actually score goals and don't just fall down and whine like babies to con the Ref, so how is this Soccer in any way?! Anyway, least interesting thing you could make.
  • Disney Speedstorm: Racing with Disney characters. Very conflicted. On the one hand, I love Asphalt (tho mostly the earlier entries), and this game is made by them, and it looks really good. On the other hand, Disney is the enemy of mankind and I'd really rather not support them. On the gripping hand, this is free-to-play? So I'll at least get it and feel bad about playing Donald Duck or some other corporate-owned character stolen from the public domain by decades of bribing Congress. Fuck Sonny Bono forever, there should be a line to use his grave as a public toilet. But I'll see you in the game lobby.
  • Star Wars Force Unleashed: Remember when Star Wars Expanded Universe & videogames was the good stuff, and Lucas had mostly fucked off, Disney hadn't bought them yet? Well. Already played this but I surely didn't finish.
  • Assassin's Creed The Ezio Collection, Kingdom Hearts Integrum Masterpiece for Cloud (no relation), Klonoa Fantasy Reverie, Portal Companion Collection, Cuphead: Shovel shovel shovelware your old games onto the Switch. Extra credit to Klonoa for literally being a Mario 64 clone that says it's a clone, and is now a reanimated corpse on Mario's system. Portal was great 15 years ago, but dude, the gag's as dead as the Companion Cube. Stop.
  • SD Gundam Battle Alliance: Almost a proper mecha game, except it's the shitty "super-deformed" fantasy setting instead of the hard SF main Gundam setting. Hard pass with annoyance.
  • Chrono Cross Radical Dreamers Edition: Remaster, sure, but a fantastic game originally, and I'm willing to put up with a 3D remaster. Also, there's a text adventure in it! BUY ON RELEASE DAY, APRIL 7.
  • Kirby and the Forgotten Land: Kirby wanders post-apocalypse, overgrown city and eats everything. Level up a town of primitive mutants to shop for powerups. Horrific glimpse of our grim future. Probably good times, will at least grab a demo if they have one. March 25.
  • MLB The Show, Wii Sports: No. Watching the tired middle-aged Japanese executives doing the bare minimum to unenthusiastically play "volleyball" is so sad. Please do not.
  • Live A Live: Unreleased (in US) JRPG in a bunch of time settings? But I've already played Another Eden. Solid maybe.
  • Taiko no Tatsujin: No, and also requires a subscription service.
  • Triangle Strategy: As previously noted, NO. Actually looks worse now that it's closer to release.
  • Earthbound: It's an N64 game in the emulator, so you could already get this. But it's a great game, a little conga line of children take on horrible monsters in malls. You'll love it. I guess this is a reason to get a Switch Online Plus sub.
  • Demon Slayer: Looks like a cute jump-and-slash. Since it's in the quick no-comment section, I assume it's cheap.
  • Mario Kart: Let's take all the old levels and charge you more in DLC for them. No, and you are a sucker if you buy these.
  • Xenoblade Chronicles 3: And now, Zamfir! Master of the pan flute! Lot of overwrought dialogue about friends and fighting and fighting your friends. I dunno. I go back and forth on these. Xenogears & Xenosaga I were fantastic, then they fired the entire team and fucked up Xenosaga II. Xenoblade Chronicles was meh, and I haven't played the sequels/remakes/expansions, confusingly numbered X, 2, 2: Torna, Future Connected, and now 3. Odds are I'm not playing this one, either.

Raspberry Pi OS 64-bit

Back up your user files (only). Don't bother configuring the installer beyond choosing "Other Raspbian" and "64-bit base", it ignores your settings, you'll have to configure the device after booting stock. But it writes the micro-SD card correctly; I didn't have to reformat it myself like last time. So I run thru my 400 setup routine again, and with minor changes it's still current.

Everything seems to work. I can run my Scheme scripts in Gauche like it was just a minute ago. Since it's 64-bit now, I should be able to install Chez Scheme from Debian! But ambitious plans later. Python is 3.9.2, which meh, fine; I've mostly updated my desktop to 3.10, but old ports require 3.9 still.

I had a weird crash with Twitch, but I've had that before; on reboot I was able to watch Twitch with no problems, but I'll keep an eye on that.

Uh, when adding things to the Main Menu, make sure they're marked executable (chmod 755 whatever).

And reminder, MagPi magazine is good content, you just have to persistently demand "free PDF", nobody wants dead trees! It does tend towards the very noob, classic WIRED magazine color/font assault on your senses, and they think IDEs are a good idea on a tiny computer. Don't do that. Just use Vim in a terminal.

Very importantly, keep your files as much as possible on a USB drive, not the internal SD card, you don't want to thrash the OS card any more than you have to.

Now the next step will be to reuse my old micro-SD card for an alternate OS, so I'm not running Linux. But if you do run Linux, Raspbian's acceptable since it only has one hardware profile to support.

What I'm Watching: Matrix 3 Revolutions

Finally rewatching Matrix Revolutions, and boy is my suspension of disbelief in this bullshit tired. I would watch Resurrections again now, but it's no longer on HBOmax, so I guess it's time to kill my subscription again. These short play windows suck.

It's weird there's still pay phones in 2005. Best I can figure they went from 2M in 1997 to <100K in 2009.

I get that Sati is a tiny child/program, so "Trainman" is a fine name for her to use, but the word adults would use is "Engineer" or "Driver".

"I've never heard a program speak of love", dude, you can make a program speak anything. You do it all the time! LOVE by David H. Ahl But they really missed an opportunity here; the program that thinks it's a person's name is "Rama Kandra", which is so close… if he was only an actuarial program named RAM who believed in The Users.

But, speaking of love, there's 5 relationships? Neo & Trinity, of course, who don't really get much time in this film, they're very moved-in-girl/boyfriend, so it's less 24/7 humping than the second film. Sati's parents, who are just NPC programs. There's Zee & Link, which is somewhat ruined by the very mechanical Nona Gaye replacing the late Aaliyah as Zee so she has no actual on-screen interactions with anyone; Link seems more into the idea of her than the actual girl. Allegedly Niobe & Locke, but they have zero chemistry, Locke clearly only gets off on losing and being whipped by the council. And the Merovingian and Persephone are back together, which is surprising and she doesn't even hint at her earlier treachery; I guess even programs forgive all for a nice rack.

I think about this stuff to kill time here. Plot resolution of first 24 minutes: Neo waits for a train and his girlfriend has to pick him up.

Every scene drags on too long. Oracle could be resolved in a couple minutes. Cruising home "nobody can fly a mechanical tunnel!" but the tunnel's plenty wide enough, it's like a street. Dock fight is an hour of flashing lights.

Why don't the gun exoskeletons have armor? Like, even a stupid half-barrel welded around them with a faceplate would make them invulnerable to the dumb squids.

How is it Neo takes so long to understand that the only "person" who ever calls him "Mr Anderson" is the "person" he's facing? If he was The One, he should be like, "YOU!", and leap to attack.

Most of us when we're gut-wounded and impaled in multiple places, go "holy shit this hurts", they don't have a quiet 10-minute monologue about feelings. More Reservoir Dogs, less Lifetime Special Movie.

I prefer mud wrestling with bikinis, even if it's Keanu & Hugo.

At least things get accomplished in this two-hour-long drag of a film. A competent editor would've taken 15-30 minutes of 2, 40-60 minutes of 3, and made a single good, short movie.

There's nothing new in this movie, not even stealing from newer movies or tech, it's just iterating out the scenario of the first movie and almost completely ignoring the second, but it's mostly competent. It only suffers from nobody being able to tell the Warchowski Siblings "no" in the editing room.

★★★½☆ I think this is the second-best of the series.

Clicky Keys

Since a soup-related accident with my Magic keyboard a couple weeks ago, I've been using a cheap, terrible backup keyboard (I tried using my big, old clicky keyboard, but it's very big and old, key switches are flaky), and looking for a good replacement.

I got my new Keychron K2 w/Gateron Red switches, and it's sweet. Kind of overly tall, I got a cheap foamy wristpad (they sell a ridiculous hard wood rest, ha ha no). Playing with the backlights, I have pulsing waves of green for now, looks very TRON in the dark (same as site aesthetics). Hooked up the nice wrapped wire cable, so I can quit using BT; I'm probably in no espionage danger out here, but I distrust BT anyway.

Good size for it, it's not full-size but not as teeny as some I've used; I might prefer one about 10% bigger. Not as sharp a click as the Northgate I imprinted on long ago, seems like much less key travel, but it's still deeper than the Magic keyboard, so gotta get used to fingers going down, up, not just over, keep tapping my fingernails on the next row.

So far I keep missing [ ] but I'll get used to them. Will take some time to get used to the cursor controls (PgUp/Dn, Home, End) on the far right, but I normally use the Mac's emacs-like keys so I don't care that much. There's a funny box icon next to Del, turns out it's Sh-Cmd-4, region screen capture!

Used Karabiner Elements as they suggest to remap keys, currently just Caps Lock->L.Ctrl, L.Ctrl->Fn, since they put Fn over on the right (great for media control, bad for anything else). They sent some replacement keycaps and a cap puller, but just for Windows equivalents. I need to order proper Ctrl, Fn keycaps.

Update 2022-01-22: I made Home/End send Sh-Cmd-[ and Sh-Cmd-] so I can easily shift window tabs. Download home-end-tabs.json and do what the README says.

What I have not got is the Das Keyboard 5QS. It literally runs a keylogger & Internet spyware to "display information" on the keyboard; I can't think of a dumber, less secure idea.

Green and Blue Bubbles Again

Some disreputable right-wing rag is pushing the Google-paid-ad conspiracy theory that Apple promotes bullying to get kids to prefer blue bubbles and iMessage to green bubbles in Android trash. Whenever this comes up, the mainstream rags never mention the real difference: Security vs. insecurity, encryption vs. everyone in the world able to read your messages.

Preferring blue bubbles is good behavior, whether kids know it or not. It has end-to-end encryption, it never even touches Apple's servers in plaintext. Anything you send, you know only the person you sent it to can ever read it. (note: You should not use iCloud backups, because those WILL store logs in plaintext)

A green bubble means it's insecure SMS; it can be read by cops, the phone company, anyone with a "Stingray" radio packet decoder in the area, and anyone who's SIM-cloned your device, which can be as simple as a single phone call to the carrier. Google is criminally negligent still shipping SMS as their "IM" in 2022.

Use iMessage if you can, Signal, Telegram, LINE if not.

Don't use WhatsApp, it's owned by Facebook and just as bad spyware as anything owned by Google.

Formatting Strings in Scheme

Most of the time I use primitive display, or print functions:

;; displays a series of args to stdout
(define (print . args) (for-each display args) (flush-output-port) )

;; displays a series of args to stdout, then newline
(define (println . args) (for-each display args) (newline) (flush-output-port) )

;; displays a series of args to given port
(define (fprint port . args) (for-each (λ (x) (display x port)) args) (flush-output-port port) )

;; displays a series of args to given port, then newline
(define (fprintln port . args) (for-each (λ (x) (display x port)) args) (newline port) (flush-output-port port) )

;; displays a series of args to stderr, then newline
(define (errprintln . args)  (let [ (port (current-error-port)) ]
    (for-each (λ (x) (display x port)) args) (newline port) (flush-output-port port)
))

but sometimes I actually need to format things:

(import (prefix (srfi s19 time) tm: ))

(format #f "~8a ~10:d ~20a" name score
    (tm:date->string (tm:current-date) "~Y-~m-~d ~H:~M:~S") )

Common Lisp format works as described in Chez Scheme, using /#f for destination, and some other Schemes as well; but most Schemes only have the nearly-useless SRFI 28. I'm aware of cat/fox/etc combinatorial formatters, but they're very verbose.

Chez also has date/time functions, but no formatter, so using SRFI 19 - nicely, SRFI 19 mostly does sane things, it's not like C's strftime.