Small programming tricks
Recorded: Sept. 17, 2026, 12:28 a.m.
| Original | Summarized |
Small Programming Tricks · will keleher writing Small Programming Tricks You probably know that ctrl + r allows searching your terminal’s command history, but if you install fzf, you can set it up so that ctrl + r does a fuzzy search. If you want even more power, atuin replaces your shell history with a searchable SQLite database. per-directory-history lets you switch back and forth between searching for commands that have been run in a specific directory or searching all previous commands. Finally, you can configure how much history to store: stackoverflow question. Modern JS now supports Array.flatMap, Object.entries, and Promise.withResolvers. You might have already known all of these things! Or you might work in a domain that makes all of these little tricks totally useless. Even if this particular set of tricks isn’t useful for you, I bet you have your own stash of tricks that you’ve accumulated over the years that makes your work easier. To debug $PROBLEM, use $DATA_SOURCE. At a previous company, I shared a trick on slack every day with the engineering team, both technical and company-specific, and folks found them pretty useful. Even if you knew 9/10 tricks, that 10th doc or technique might save you some time! And one trick per day was the right number to avoid overwhelming people with knowledge, and it could occasionally spark useful discussion. If you’re a more senior engineer at your company, you might think about doing something similar. I think I first saw this technique on Julia Evan’s blog, and I think her writing often perfectly encapsulates the idea behind this post: "small bits of knowledge are powerful! and fun! and approachable!!" ↩︎ |
The author posits that a significant amount of engineering productivity stems from acquiring small nuggets of knowledge. These pieces of information, ranging from knowing an obscure language feature to understanding specific system behaviors, are valuable because they offer shortcuts that do not require extensive mental infrastructure. The text provides numerous examples of such highly useful tricks across various domains. In the realm of command-line tools and shell interaction, the author highlights enhancements available through tools like fzf, which can extend the functionality of ctrl+r history search into a fuzzy search mechanism. Further customization, such as using atuin to replace shell history with a searchable SQLite database and using per-directory-history to manage command history context, are cited as examples of leveraging existing tools for greater efficiency. Specific SQL knowledge is also emphasized, noting that SELECT without a FROM clause can be useful for testing relational logic, such as verifying the behavior of operators like SELECT TRUE <> NULL. For database optimization, the availability of explain analyze in systems like PostgresSQL and MySQL is presented as a resource that provides substantial performance information regarding a query. In programming and data manipulation, the text points to specific syntactic and functional additions that simplify tasks. Regular expressions benefit from the word boundary assertion, \b, which simplifies pattern matching around word beginnings or endings. Modern JavaScript features such as Array.flatMap, Object.entries, and Promise.withResolvers are noted as recent advancements. In Node.js development, managing external resource connections can be improved by using an https.Agent with http requests, which can significantly impact latency. Git possesses powerful commands like git log -S pattern, which can track changes by examining commits that added or removed a specific string within a codebase, and git checkout - to easily revert to previous HEAD states. Furthermore, the suggestion is made that find commands can often be replaced by shell globs, such as **/*.md, with bash requiring shopt -s globstar to enable this functionality. The substitution of general grep utilities with ripgrep (rg) is also recommended. Finally, setting up advanced zsh autocompletion, including configuring paths via brew and initializing completion functions, is suggested for power users. Beyond specific technical commands, the author argues that high-leverage knowledge in a company setting often takes the form of relational insights rather than just technical commands. This includes knowing how to debug a problem by referencing the relevant data source, recognizing that a specific person possesses expertise in a certain area, knowing where to find good documentation for a complex topic, understanding that a system state implies a need for manual scaling out, knowing the command for rolling service restarts, and recognizing utilities that can simplify scripting. The underlying philosophy is that acquiring these small, context-specific pieces of knowledge—both technical and organizational—can be powerful, fun, and approachable. |