Posts

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.

Should I put my systemd [Install] section in my .path file or my .service file?

Configuring systemd to redeploy my service when I commit a new source .jar file, I have a path file that goes along with the service and uses a PathChanged directive. The [Install] section should be in the path file, not the service file, but I notice this makes “systemctl enable MYAPP” impossible. It turns out that enable MYAPP assumes you mean MYAPP.service, so you actually just do systemctl enable MYAPP.path and you’re set.

Split/shorten a PDF with pdftk

You can use pdftk to reduce a 150-page PDF to a just the pages you care about. pdftk ORIG_FILE.pdf cat 1-5 output NEW_FILE.pdf

Tip: shortcut for kill-this-buffer

I have added the following shortcut, possible since exwm frees up my s- key: (exwm-input-set-key (kbd "s-<backspace>") 'kill-this-buffer) And, for when I am already in an emacs buffer, this added to my personal key map: (define-key map (kbd "s-<backspace>") 'kill-this-buffer) In any case, making a single-chord shortcut for kill-this-buffer has highlighted how often I use the command, and made work that much faster. Highly recommended!