Clojure exercise to transpose three lists

The need: take multiple vectors and view each vector as a column (not a row) of the data, so all the first items go together, all the second, etc. Here’s a rough version that felt too clunky (alert: it features a number) and fragile but happens to demonstrate the needs: (let [[names jobs langs :as all] [["john" "jane" "michael"] ["chef" "driver" "vet"] ["English" "German" "French"]]] (map #(zipmap [:name :job :lang] %) (partition 3 (interleave names jobs langs)))) ;; ({:name "john", :job "chef", :lang "English"} ;; {:name "jane", :job "driver", :lang "German"} ;; {:name "michael", :job "vet", :lang "French"}) Solution (let [[names jobs langs :as all] [["john" "jane" "michael"] ["chef" "driver" "vet"] ["English" "German" "French"]]] (apply map #(zipmap [:name :job :lang] %&) all)) ;; => ({:name "john", :job "chef", :lang "English"} {:name "jane", :job "driver", :lang "German"} {:name "michael", :job "vet", :lang "French"}) This solution taught me two new things:

Love lost: when exwm falls short

I find myself going back to regular WMs (my favorite from the past being KDE) because certain tasks are just deeply punishing in EXWM. When I’m doing my regular daily work I can usually make EXWM work for me. But here are the facts I experience with/without emacs as my window manager. Life is worse without EXWM Winum. Looking at a screen and hitting the num to focus there; I miss it dearly and cringe when I need to reach for the mouse.

Rebinding Keys, or, The Horror of Alt+TAB in Emacs

I use exwm so M-TAB is available to me without being hijacked by the OS, but rebinding this failed in surprising places. I want it globally to be set to iflipb-next-buffer (giving familiar alt+tab functionality to exwm), but if any of the buffers I’m travelling past happen to inherit magit or gnus, my tab-sequence gets broken because they have it bound to their own thing and I can’t seem to rebind it.

Customizing or disabling Ivy/Swiper pre-selects

By default ivy/swiper/counsel (not sure which) will visit all results as I scan through a list, e.g. when going through my buffers. I thought I liked this until working on my exwm with multiple monitors and non-emacs buffers are only allowed to appear once, meaning that simply moving down my selection list caused screen to be stolen from my other monitor. Answer Buffer-changes are apparently an effect of using counsel-switch-buffer, which I had bound to C-x b.

Creating ToryAnderson.com with ShadowCLJS

After years of a languishing example of The Cobbler’s Children , I finally got around to renovating my own website: toryanderson.com. Admittedly I have a lot to learn about visual design, but I had a good time on the technical front. I took the opportunity to use technologies I love and have been pleased with the result – both in the product and the cost constraints. In other words, it was fun to build and cheap to host: Clojure[script] meets shared hosting.

Fix invalid submodule error when using straight.el

My ordinary workflow was to start emacs with a load into my orgmode agenda, which locates me in my .emacs git-project. Upon inspecting my agenda I’ll go to some project from my todo list using helm-projectile. However, after switching to Staight.el (which does its heavy lifting with git) this workflow was broken. The result is that, when I try to use projectile from somewhere that Git includes Straight stuff, I get this failure about submodules:

Accordions out of the box with Clojurescript and Closure

Accordions are actually available out-of-the-box in Clojurescript with the included Google closure.js that Clojurescript is built upon. This code shows the AnimatedZippy, which has a nice slide-out function; there’s also a plain Zippy. They are drop-in replacements for eachother. Rendering the Accordion (Zippy) (ns toryanderson.views.components.shared "Shared components that may be used on multiple views" (:require [reagent.core :as r] [goog.dom :as dom] [goog.string :as gstr]) (:import goog.ui.AnimatedZippy)) (defn accordion [{:keys [header-text content-body]}] (let [header-id (gstr/createUniqueString) content-id (gstr/createUniqueString)] (r/create-class {:display-name "zippy" :reagent-render (fn [id] [:div.

Compress (bulk) pdf with Ghostcript

One liner with ghostscript GS to make your pdf much smaller. Options for PDFSETTINGS are (in rank of output quality): /prepress /ebook /screen gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf En Masse Compression: 972M -> 457M I applied this with a script upon my 972M directory of hundreds of research pdfs, and the end result was less than half the size (457M). I converted each PDF to text, which is useful for most of them, and then moved each PDF to an “uncompressed” directory, then compressed that uncompressed/FILE.

Compress pdf with Ghostcript

One liner with ghostscript GS to make your pdf much smaller. Options for PDFSETTINGS are (in rank of output quality): /prepress /ebook /screen gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf Resources https://itsfoss.com/compress-pdf-linux/

Clojure app setup for Auto-deploy with raw systemd

REPLACED [2022-11-11 Fri] The below is hopefully informative, but it actually only causes a thing to deploy once and then to re-deploy on system restart. For instructions that ACTUALLY auto-deploy, see https://tech.toryanderson.com/2022/11/11/systemd-devops-run-and-restart-services/ Updated [2022-09-19 Mon] Fixed error in deploy script that occurred if trying to restart but nothing was in the docket Updated [2022-07-13 Wed] Enhanced the server-side deploy script to operate more transparently if files are missing.