Daily Notes for 2023-06-04

ยท 1297 words ยท 7 minute read

Denote and encrypted notes ๐Ÿ”—

I want to have access to my Denote notes via SyncThing on a machine I don’t completely control (but is not, to be clear, operating in a hostile environment) and I want them to be encrypted, same as my org-journal files. I should probably just ask Prot, but as near as I can tell the clean way to encrypt notes in Denote is to add an “org.gpg” type to denote-file-types, like this:

(add-to-list 'denote-file-types
             '(org-gpg
               :extension ".org.gpg"
               :date-function denote-date-org-timestamp
               :front-matter denote-org-front-matter
               :title-key-regexp "^#\\+title\\s-*:"
               :title-value-function identity
               :title-value-reverse-function denote-trim-whitespace
               :keywords-key-regexp "^#\\+filetags\\s-*:"
               :keywords-value-function denote-format-keywords-for-org-front-matter
               :keywords-value-reverse-function denote-extract-keywords-from-front-matter
               :link denote-org-link-format
               :link-in-context-regexp denote-org-link-in-context-regexp))

It looks like a lot to do a little, but it’s just a clone of the org type that’s already in that list, with the extension changed. I suppose one could just alter the org type, but then you don’t have an unencrypted type if you want it.

With that in place, you can do:

(setq denote-file-type 'org-gpg)

… and anything you create with the denote command uses that type, with the correct extension. Given the right general config:

(require 'epa-file)
(epa-file-enable)
(setq org-crypt-key "[email protected]")

… it all “just works,” with decryption handled transparently provided the gpg agent is set up correctly, and I preserve the option to have unencrypted notes for whatever reason I might want them at some point.

To get my existing notes into an encrypted state, I used this script:

#!/bin/zsh

encrypt_file() {
  local file_path="$1"
  local recipient="$2"
  local encrypted_file_path="${file_path}.gpg"

  gpg --encrypt --recipient "$recipient" --output "$encrypted_file_path" "$file_path"

  echo "File encrypted: $encrypted_file_path"
}

encrypt_files_in_directory() {
  local directory="$1"
  local recipient="$2"

  for file_path in "$directory"/*.org; do
    encrypt_file "$file_path" "$recipient"
  done
}

# Usage: ./encrypt_files.sh directory recipient_email
directory="$1"
recipient_email="$2"

if [[ -n "$directory" && -n "$recipient_email" ]]; then
  encrypt_files_in_directory "$directory" "$recipient_email"
else
  echo "Usage: ./encrypt_files.sh directory recipient_email"
fi

The mobile problem ๐Ÿ”—

The tradeoff with that approach is that your mobile use case gets harder. I can still do something like mosh my way in to the Mac Studio with Tailscale, I guess.

I have the nagging feeling that Emacs-centric note taking wouldn’t work great for me if I were dealing with a commute or other scenarios where mobile access is more important. Yes, there are beorg, Plainorg, and a few other options, but the syncing layer is the complicator. Some people seem to live fine just using git and maybe git-auto-commit, or just generally being more disciplined about their file use. I have generally felt better served by bespoke solutions, like you get with Obsidian, Things, and others. They’re still subject to the occasional screwup, but I don’t feel like I see them as often as I do with things that simply watch a file system and try to react appropriately.

I have been doing a little personal journaling about my preoccupations with mobile stuff. After tracing things back over the years, I recently realized that a lot of my fixation on getting stuff to work on a phone came from a pretty terrible time during the 2001 downturn.

All my teammates had been laid off and I was holding down a small network of Linux/open source sites that had previously involved a much larger team. If I didn’t want things to get out of control I had to keep an eye on them over the weekend. That mentality caused a lot of lines to blur and it took years to unblur them. I was an early iPad enthusiast because I’d internalized the idea that I should be able to do all kinds of work from anywhere at any time. Before that, I was really into the netbook thing because I could put an eeePC into a hip bag.

By the time I got to Puppet in 2012, working from home wasn’t a novelty or an aspirational goal: I’d been doing it for 13 or 14 years and was really glad to have an office to go to. Covid lockdown sparked a pretty bad reaction after the initial “let’s build a fire and sing songs while we wait for the drop ship” phase because lines started blurring again.

At the same time, just last week I had a pair of things to do in the afternoon and I’d written some thoughts down about one of the events that I wanted to review while I was out of the house. Well … apparently SyncThing hadn’t picked up on the changes before the machine I wrote them on went to sleep, so none of the other machines in the mesh — including a Synology I put SyncThing on for just these occasions — knew the notes existed.

At some point, “oh, no problem, I’ll just Tailscale in to the home network and WoL the Mac Studio so I can wake up SyncThing and then sync my changes down” loses all its charm.

Ugh. Need to stop before I talk myself into doing something rash and disruptive.

Hugo previews while working in ox-hugo ๐Ÿ”—

I’m not sure if there’s a better way to do this, but this is working for me:

(defun mph/start-hugo-server ()
  "Run Hugo server with live reloading and open the server URL in a browser."
  (interactive)
  (let* ((root (projectile-project-root))
         (default-directory root))
    (compile "hugo server -D --navigateToChanged" t)
    (run-at-time "3 sec" nil (lambda ()
                              (browse-url "http://localhost:1313")))))

(defun mph/stop-hugo-server ()
  "Stop Hugo server."
  (interactive)
    (kill-compilation))

(map! :leader
      (:prefix ("H" . "Hugo")
       :desc "Start Hugo Server" "S" #'mph/start-hugo-server
       :desc "Stop Hugo Server" "s" #'mph/stop-hugo-server))

I get a little Compiling treatment in the modeline while the preview server is running. My browser reloads any time I save my work.

What happened to V ๐Ÿ”—

I always sort of wondered what happened to V between the miniseries and the regular series. I had a vague sense it had gotten worse, but I was also a teenager and didn’t have a lot of critical faculties beyond “this seems sort of sucky and boring now.” Well, now I know: They got rid of the person who created it, made it cheaper, and tossed out what someone thought were the dumb parts, which were actually the good parts.

Interesting factoid:

V was watched in more than 33 million homes, which amounted to 40 percent of all TV viewership. (The most popular series in America today, Yellowstone, averages 13.1 million viewers per episode.)

I recently tried to dig up what’s considered “good numbers” in the streaming era and didn’t get many satisfying answers. Seeing that a modern phenomenon like Yellowstone pulls about 40 percent of V’s numbers is helpful. V was hyped all to hell at the time, so its “television special event” status probably skews things a little. (The M*A*S*H finale did 105.97 million total viewers, and that record may be impossible to break as streaming-driven atomization deepens.)

“The Phony Solidarity of the American Pundit Class” ๐Ÿ”—

I got to this post in The Nation after it sat on the read later pile for a while.

It’s very strange to see the post-2016 realignments continuing apace. This particular link targets the slice of the center-left-to-center-right commentariat that has learned to talk about “working people.” That tic — the “won’t somebody think of the working people” tic — feels symptomatic of a kind of elite capture all its own.

I wrote a few years ago:

“I have a lot of time for some heterodox thinkers. I wish ‘heterodox’ was narrow-able to something less broad than ‘a coalition of middle class trolls, rebadged culture warriors, people who hate how much they get ratioed, and well-meaning independent thinkers.’”

I think I may need to retract that. I was going through the podcast searching for an episode and saw a few descriptions here and there that tell me “heterodox” has stopped being a word one lands on after casting about for a better one, and has become a sort of branding exercise.