I have read many books in 2025; let’s forget most and talk about the good ones. There is no particular order, but I broke down my recommendations by categories: technical , non-fiction and fiction . This is a yearly tradition! You can read my book reviews from previous years: 2015 2016 2017 2018 2019 2020 2021 2022 2023 and 2024 . Yes, this year is pretty short, but this is all I have for “best…
A Quick Why I won’t try to sell AWK in this post, I’ve done it before. Over time, I’ve migrated most of my utility scripts to AWK; it’s my default choice when I write new scripts. The “classic” way, though simple, forces you to live inside a bash string. We can do better. The “Classic” Way Let’s write a simple script, to show line-length along with content. This isn’t about AWK programming; the…
Background It wasn’t my first time standing over a lasagna pan, trying to eyeball how to cut it into 6 equal portions. Cutting anything in 2 seems relatively easy to estimate. And, in the worst case, you can fall back on I cut, you choose . What about cutting in 3? Eyeball it? Is there a better way? no rulers available but something like a square to make straight lines and 90° angles as precise as…
Surrounding text in Vim/Neovim is not strictly complicated, but finding a good workflow is not immediately obvious either. Recipe select text (your pick), c "" , ESC P Step by step below. Step 1: “changing” text Select text, and press c (change mode). Alternatively, it’s that more convenient, you can use a “ text object selection” like ciw to “change” a specific something. select some text press c…
What is LocalSend? LocalSend is an AirDrop replacement. Why? From my experience, AirDrop either works great! is completely broken… In practice, my problems came down to which versions of MacOS and iOS I have around which OS updates have been run and when how long since I’ve rebooted my devices and/or Bluetooth It’s super frustrating to think “oh, I’ll just transfer this file to my computer real…
Problem wc -l is pretty good at counting lines, it’s what most people use # man cat | wc -l 71 Except that it collapses all your data to a single number. There’s nothing wrong with that if you’re only trying to get the answer. But when you’re building long one-liners with multiple pipes, it’s useful to answer two questions at the same time how many lines is that? are those lines what I expect?…
Previously, in Using recon_trace with Elixir , I had laid out a foundation for using :recon_trace specifically with Elixir. Since then, I decided to spend some time and “fix” the logging so I wouldn’t have to eyeball-decipher Erlang-flavored dumps. The problem Imagine a very simple Pet module defmodule Pet do defstruct [ :name , :age , :type ] def just_cats ( pets ) do pets |> Enum . filter ( & (…
I have read many books in 2024; let’s forget most and talk about the good ones. There is no particular order, but I broke down my recommendations by categories: technical , non-fiction and fiction . This is a yearly tradition! You can read my book reviews from previous years: 2015 2016 2017 2018 2019 2020 2021 2022 and 2023 . Technical Tidy First? This is a short (<100 pages) and cute book. If you…
While most macOS users know how to take and use screenshots, I would argue there are 2 ways to improve the experience. Dump your screenshots in a dedicated folder By default, all screenshots are saved on the Desktop with a name like Screen Shot 2024-11-19 at 13.10.06.png But the Desktop is a terrible place to dump stuff. At this rate, it’s just going to become a mess. I like to put all my…
Background Recently, I’ve been experimenting with WezTerm and Neovim . And I’ve also been trying various colorschemes . 1 Things didn’t look right, but since I had been changing so many things at the same time, it was hard to pinpoint the cause. It’s subtle, but it’s there. Neovim running outside tmux: blue-ish “tokyonight” theme popup in (slightly) different color (black) Neovim running inside…
Most people know they can add functions to the shell, but often limit themselves to their dotfiles. Nothing stops you from adding functions to your running session. Functions in interactive shells If you’re already in a shell, you can define a function in exactly the same way you would in a startup script, by typing it at the prompt: # this is bash > ll () { ls -l } > ll # runs `ls -l` # this is…
The Template Itself If you need to copy-paste: for { name , params } <- %{ "test name 1" => %{}, "test name 2" => %{}, "test name 3" => %{} } do @tag params: params test name , %{ params: params } do # use params.??? throughout end end Bonus: no library or extra framework. How It Works? It’s easy to miss, but the ExUnit documentation mentions @tag By tagging a test, the tag value can be accessed…
Situation If you’ve been stuck in a terminal where ctrl-c didn’t seem to work > bash sig-catcher loop 1 loop 2 loop 3 ^C loop 4 loop 5 ^C^C^C^C loop 6 loop 7 loop 8 # it keeps going ... you know how frustrating it can be. 🤬 Try ctrl-\ Think of ctrl-\ 1 as a “harder” ctrl-c > bash sig-catcher loop 1 loop 2 loop 3 ^\sig-catcher: line 5: 38922 Done It doesn’t always work, but it’s worth trying.…
I wrote before about psql Tips and Tricks . This is more useful stuff I picked up since then. Quick links: pretty-printing JSONB better aggregate functions format wrapped Pretty-printing JSON(B) columns In a query result, JSONB columns can be hard to read: > select asin, payload from imports where asin = '0486217094'; asin | payload…
( 2025-02-16 update : How to get Elixir logging with recon_trace ) This year, I finally got around to learn recon_trace . With this post, I intend to make your journey smoother and faster than mine. What is recon_trace? In my own words: recon_trace allows you to attach an IO.inspect to any module/function in a running BEAM, without crashing it Directly from the documentation : recon_trace is a…
Background Over Christmas, I decided that it was a good time to try the Gleam track on Exercism . I prefer to start without doing too much research. Once the Exercism executable creates its directories and stub files, that’s when I start looking at tooling. For me, it starts with Vim: no highlighting, but that wasn’t too surprising – it’s early days for Gleam. It wasn’t hard to find Gleam syntax…
I have read many books in 2023; let’s forget most and talk about the good ones. There is no particular order, but I broke down my recommendations by categories: technical , non-fiction and fiction . This is a yearly tradition! You can read my book reviews from previous years: 2015 2016 2017 2018 2019 2020 2021 and 2022 . Technical Surprisingly, I don’t have anything to recommend in this section…
Quick links: better defaults variables temporary tables Why psql? psql is a terminal-based front-end to PostgreSQL. It looks like this: Why you would use psql when there are so many other clients available? 🤔 My short answer is that, sooner or later 1 , you can end up on the wrong side of an ssh session, and psql is going to be all you’ve got. It also doesn’t hurt to learn a few tricks (or to…
What is this? A few days ago, I saw the videos for the 2023 Strange Loop conference starting to land in my YouTube feed. This started out as a relatively simple question: which videos should I watch? It wasn’t my first time looking at a list of videos on YouTube and wondering how to find “the best ones”. The rest of this post is the journey ; trying to find an answer. I wrote this for a few…
What is entr? entr is just a file watcher. The README says: Run arbitrary commands when files change It’s available for most package managers: brew install entr A simple example List the files you’re interested in, one per line: > ls * .txt a.txt b.txt c.txt Now feed them to entr with the command you want to run: > ls * .txt | entr make Why entr? A lot of projects and languages have their own…
I mentioned in Reduce is Not the Answer how: reduce is fairly low-level reduce doesn’t capture “intent” Very loosely, I believe that “loop constructs” fall somewhere on this abstraction scale: Exact placement is subjective; this is a starting point. As for ?? and beyond, it might correspond to well-named functions with custom looping logic. For example, mean and stdev would fit the bill. However,…
TLDR The reduce function: can do anything , and often does… fails to communicate intent compared to its alternatives reduce is the for-loop of functional programming… What is reduce? The reduce function takes a collection, iterates over it, and generates a single value. Depending on the language, it might also be called: fold , accumulate , aggregate , compress , or inject . // a quick JavaScript…
Spreadsheets aren’t my favorite things, but I’ve spent a decent amount of time using them. A few weeks ago, I stumbled on a blind spot … is there a way to EXPORT formulas? Looking At Formulas You might already be familiar with this trick: ctrl backtick 1 will toggle cells between showing their values and their formulas: ⚠️ This works in Google Spreadsheet as well ⚠️ This can really help making…
A lot of people don’t know that join exists, or what it does 🤔 I mean the join command that’s already on your computer and ready to go: # BSD (macOS) > join usage: join [-a fileno | -v fileno ] [-e string] [-1 field] [-2 field] [-o list] [-t char] file1 file2 # or # GNU (linux) > join join: missing operand Try 'join --help' for more information. What is join? Believe it or not, join is part of…
What is Livebook? The easiest way to explain Livebook is to say it’s Jupyter notebook for Elixir . Another way? What if Word and Excel had a baby? combine text and formula (or code) see the results in a cohesive document Why Livebook? As an Elixir developer, I didn’t really understand where Livebook was supposed to fit. After all, I already knew how to start a new project, or launch iex (Elixir’s…
I have read many books in 2022; let’s forget most and talk about the good ones. There is no particular order, but I broke down my recommendations by categories: technical , non-fiction and fiction . This is a yearly tradition! You can read my book reviews from previous years: 2015 2016 2017 2018 2019 2020 and 2021 . Technical Domain Modeling Made Functional If you wanted to learn how to do…
Do you babysit long-running applications? You could display a desktop notification, but it’s even nicer (and mouseless) to know how things went without looking. My use case I run mix test in another tmux window; it’s “offscreen” for all intent and purposes. I use entr to trigger mix test : my tests will run when files change. > git ls-files | entr mix test # if `git ls-files` is too large, I use a…
tl;dr The answer is on stackoverflow : if ( RectA . Left < RectB . Right && RectA . Right > RectB . Left && RectA . Top > RectB . Bottom && RectA . Bottom < RectB . Top ) which is correct but not especially obvious. A LOT of people think the stackoverflow answer is wrong and try to “fix” it 🤣 Step by step: in one dimension Let’s simplify the problem: let’s focus only on one dimension – the x axis…
Not just JavaScript… While this post uses process.env – JavaScript, TypeScript, and node – to make a point, none of the problems listed are JavaScript-specific. I’ve seen this done in almost every languages. The Setup Using process.env is sooooooo easy … too easy: const databaseName = process . env . DATABASE_NAME ; // use databaseName to connect to a database? What is wrong with this code?…
(Disclaimer: I wrote vim-slime ) Installing a vim plugin: probably not fun… Maybe you’ve heard about vim-slime , thought it was cool … but you weren’t sure what you were getting yourself into 🤔 That’s understandable … I feel the same about every vim plugin: is it going to be simple to install? will it interfere with other plugins? if something breaks, will it be easy to fix? how much config will…
It started with a conversation with my parents. We were talking about my work, legacy software and maintenance: But if that software is working … why does it need maintenance? At the time, I didn’t have a ready-made answer. old software is crap? we do things differently now? things need to be updated? Why does software rot? It is sometimes called software rot (or bit rot): […] a slow deterioration…
I recently stumbled on something that I thought would be easy: parsing and validating dates in Awk. Some guidelines: ISO 8601 format, e.g. 2022-04-12 months between 01 and 12 days between 01 and 28-31 (depending on the month, leap year) A quick lookup for GNU Awk’s time functions points to mktime("YYYY MM DD HH MM SS") Let’s try it: > echo "2022 04 12" | awk '{ print mktime($0 " 0 0 0") }'…
Help me help you When I’m at someone’s desks, in person or virtually, it drives me crazy to see the heroics of typing everything in a REPL … Let alone trying to manually fix broken code on in a REPL… Or losing their work when exiting the REPL, and trying to grab fragments from the scrollback 😿 It doesn’t have to be like this… REPLs aren’t perfect… I ❤️ REPLs and they have great features:…
(when I switched my shell to zsh , I mentioned that I would try fish and report back: this is it.) TLDR: fish shell is awesome! including features I didn’t know I wanted but, it’s not common – enjoy it on your own devices, but don’t expect it to be the default shell when you ssh somewhere Truth in Advertising The front page of the fish shell has a “sales pitch” I rediscovered it while coming up…
I have read many books in 2021; let’s forget most and talk about the good ones. There is no particular order, but I broke down my recommendations by categories: technical , non-fiction and fiction . This is a yearly tradition! You can read my book reviews from previous years: 2015 2016 2017 2018 2019 and 2020 . Technical Crafting Interpreters I knew I would buy and read this book since the first…
How do you read non-JSON inputs with jq? This isn’t obvious if you don’t already know how to do it… The manual says: --raw-input/-R: Don't parse the input as JSON. Instead, each line of text is passed to the filter as a string. If combined with --slurp, then the entire input is passed to the filter as a single long string. Clear yet? An Example $ cat fruits.txt apple banana cherry kiwi orange…
Azerbaijanian Translation , thanks to Amir. Spanish Translation , thanks to Laura. While both Chrome and Firefox have great developer tools; I had almost forgotten that Chrome has a Coverage Tab ~ I hadn’t needed it in a long time. It does both JavaScript and CSS; although I’ve only used the CSS part. For JavaScript, it is often easier to instrument procedural code with console.log . How to Use…
Short version: module names and file names don’t have to match! There is a convention, but mix doesn’t enforce it. Background I became fully aware of this after I renamed a directory under lib/ , but everything kept working… This wasn’t what I expected. I ran my tests expecting to be told what I had broken. At first, I thought it was a caching problem. I removed the _build and deps directories and…
I had not tried to write my own mix tasks until this week. The Mix.Task documentation made it look ridiculously easy: In summary: create a file under lib/tasks use Mix.Task define a run/1 function – receives the command-line arguments (as a list of strings) And… it worked. I felt awesome . A Small Problem My new task didn’t show up with the others in mix help . A quick search took me, ironically ,…
Over the years, I wrote a bunch of quick JavaScript apps with code similar to: document . addEventListener ( " keydown " , ev => { // ESC if ( ev . keyCode === 27 ) { // ... } // Enter if ( ev . keyCode === 13 ) { // ... } // ... but I found out recently that keyCode is deprecated : What now? There are better options! Let’s have a quick look at available KeyboardEvent properties: document .…
Spanish Translation , thanks to Laura. Georgian Translation , thanks to Ana. Bulgarian Translation , thanks to Zlatan. French Translation , thanks to Chema. Whatever directory you start a new Tmux session in, that’s the directory that will be used for each new window you create. Tmux is the workhorse of my local development workflow. When I cd into a directory and start working outside a Tmux…
For years, I’ve been solving the wrong problem: how do I cd.. efficiently? I realized that my real problem was: how do I cd.. back to a project’s root directory? The insight, obvious in retrospect, is that most projects have a .git directory at their base. The Manual Way… I’ve played with multiple solutions over the years, the fully manual one : # almost this, see link above alias b = "cd .." #…
Switching off the git master branch was easier than I expected! Changes are coming… I had heard about the controversy about git’s master branch. I didn’t have a strong emotional attachment to the name… so I decided to switch and see what happens. It seems like main is the consensus for the new branch name: it’s short it’s easy on muscle memory (has the same first 2 letters) it translates well to…
I have read many books in 2020; let’s forget most and talk about the good ones. There is no particular order, but I broke down my recommendations by categories: technical , non-fiction and fiction . This is a yearly tradition! You can read my book reviews for 2015 , 2016 , 2017 , 2018 and 2019 . Technical Programming Phoenix Before reading this book, I felt that I needed to read a bunch of other…
Imagine a simple Go project: . ├── go.mod ├── main.go └── stats └── avg.go No tricks: click to enlarge You are about to create stats/avg_test.go : what is the right package name declaration for that file? package stats package stats_test [reveal the answer] Both 1 and 2 are correct ⚠️ BUT they will work differently... (keep reading) Urgh… What? Here’s what Go in Action says: The convention for…
Spanish Translation , thanks to Laura. Georgian Translation , thanks to Ana. What is Skitch? Skitch is a screenshot-grabbing and annotating software. Skitch is free and available for macOS. Here’s a typical example of how I would use it: Why is Skitch awesome? It is effortless and “transparent”. Fish don’t know they’re in water ( … ) That’s how I feel about Skitch… I barely ever think about…
Spanish Translation , thanks to Laura. Georgian Translation , thanks to Ana. For years, I customized web pages by opening up Developer Tools , looking for the right DOM elements and deleting them. Classic cases include: leftover ads annoying GIF images modal popups “Accept cookies” banners helpers “share” toolbars excessive headers/footers Click to Remove Element I had reached a point where I…
I had heard about Zsh before: I thought it had many good things going for itself. But… is it enough to switch shells?! I spent years reading about, studying , often writing about Bash. I didn’t feel like Bash was holding me back. 😐 When Apple announced (2019) that Catalina would use Zsh as the default login shell… I thought it might be time to, at least, do some due diligence on Zsh. It Starts…
Problem Quick: why is this JSON not valid? { “user”: { “username”: “jpalardy”, “first_name”: “Jonathan”, “last_name”: “Palardy” } } [reveal the answer] Curly quotes! Trick question? Yes and no... this happened to me and it was difficult to troubleshoot visually . A Class of Problems… Many text formats, programming languages and other machine-parsed texts have rules about what characters are…
When dealing with directories in bash, some obvious things seem like too much work… Here are 2 quick tips for easier handling of directories in bash. unix-filename-rubout When dealing with long directory names, you can usually complete forward by pressing TAB . But going backward? … that usually means pressing BACKSPACE repeatedly. There is a better way: unix-filename-rubout . Add this to your…