blog
Links #65
- Astral Codex Tex — Book Review Contest 2024 Winners
mentioned in the article: What if Marvel was real (I don't listen to podcasts, but this one seems original and fun)
“What would it be like to live through the original Marvel Universe as it was happening”. The hosts speak in modern vernacular, but otherwise live in the world of the early Silver Age of Marvel Comics. The first episode takes place in November 1961. The Thing and the Human Torch have just been spotted in the city, but no one knows who or what they are.
- Strava Segment Tutorial: Removing Suckage and Promoting Quality possibly outdated, but I love the level of detail
- Berlin to Copenhagen for Beginners: My First Bikepacking Adventure in 2024 great pictures, among the other things
- Multiplying matrices using functional programming I already knew
that (I think) rather famous expression of
transpose
, but I've never seen the rest
Links #64
- Folding an A4 sheet into its own envelope
- arrived here reading these delightful weekly notes from the same author
- Penovác's Cats "Endre Penovác (Serbia, b. 1956) paints cats using a unique wet-into-wet technique."
- plot.awk
- an example by the author on X.com
- awesome-glsl Compilation of the best resources to learn programming OpenGL Shaders
- Atkinson Hyperlegible Font
Links #63
- visible earth A catalog of NASA images and animations of our home planet
- The Pentium as a Navajo weaving
- Ray Tracing in one weekend
- 88x31 Collection
Links #62
- Public Work Public Work is a search engine for public domain content. Explore 100,000+ copyright-free images from The MET, New York Public Library, and other sources
- My Org Roam Notes Workflow by Hugo Cisneros
- How I publish my digital garden to the web with org-publish
How I use :dbconnection in org files
In the post "Followup on secrets in my work notes" Magnus Therning mentions a feature in Org Babel I contributed to (in ob-sql.el, to be more precise).
You can see my old post for details about that feature, but basically,
the patch allows one to use a :dbconnection
header argument in a
source block to reference a connection defined in
sql-connection-alist
.
The question in Magnus' post is a signal somebody is actually using this feature, so I am pleased. Perhaps I should also follow up, describing how I use this feature in my workflow. This will constitute another example of how to manage secrets.
I use Org, among other things, to keep work "lab notes" that usually contain SQL queries on different databases.
At work, pretty much all databases are Postgresql or Redshift, and I
keep connection details in ~/.pgpass
, following this format:
In other words, every DB definition is made of two lines: the first is a comment, with the name of the database (with no spaces); the second contains the actual connection details.
In my Emacs configuration, then, I have this function:
(defun get-connection-alist (filename) "Gets PG connections details from ~/.pgpass file (FILENAME)." (with-current-buffer (find-file-noselect filename) (let ((lines (split-string (buffer-string) "\n" t))) (when lines (cl-loop for (k v) in (seq-partition lines 2) collect (cl-destructuring-bind (host port db user password) (split-string v ":" nil) `(,(replace-regexp-in-string "^#\s+" "" k) (sql-product 'postgres) (sql-port ,(string-to-number port)) (sql-server ,host) (sql-user ,user) (sql-database ,db) (sql-password ,password))))))))
and
(setq sql-connection-alist (get-connection-alist "~/.pgpass"))
I use Emacs in daemon mode and it's not unusual Emacs to stay up for
weeks, so I also have an automatic way to incorporate .pgpass
changes,
using filenotify
.
(file-notify-add-watch "~/.pgpass" '(change) (lambda (evt) (setq sql-connection-alist (get-connection-alist "~/.pgpass"))))
Reactions and follow ups
- Andreas Gerler describes his approach and setup here: Emacs and SQL