Small Programming Tricks

Sep 16, 2026 10:56 PM - 1 hour ago 1

Day to day, I deliberation a astonishing magnitude of engineering productivity comes from mini nuggets of knowledge: being alert that a connection characteristic exists; knowing that an unexplained tcp hold is astir apt related to the TCP_NO_DELAY mounting and Nagle’s algorithm; knowing the correct git incantation to get retired of a pickle; aliases knowing a instrumentality pinch sed to rewrite a file.

In 1 sense, this is self-evident: thing you cognize is going to beryllium made up of smaller pieces of knowledge. Of course those smaller pieces of knowledge matter.

But I deliberation location are immoderate nuggets of knowledge that are peculiarly valuable and don’t require a batch of supporting intelligence infrastructure. You don’t request to cognize immoderate python to usage python3 -m http.server to commencement a elemental server successful a directory, but it mightiness still make your activity marginally easier. Let maine stock a fewer examples:

  • You astir apt cognize that ctrl + r allows searching your terminal’s bid history, but if you instal fzf, you tin group it up truthful that ctrl + r does a fuzzy search. If you want moreover much power, atuin replaces your ammunition history pinch a searchable SQLite database. per-directory-history lets you move backmost and distant betwixt searching for commands that person been tally successful a circumstantial directory aliases searching each erstwhile commands. Finally, you tin configure really overmuch history to store: stackoverflow question.
  • You tin SELECT without a FROM. This tin beryllium useful for testing retired really a usability successful your database really useful aliases reminding yourself really SELECT TRUE <> NULL works.1
  • PostgresSQL and MySQL some support explicate analyse which will really tally the query you’re trying to optimize and springiness you a ton much accusation astir its performance.
  • In regular expressions, \b, the word bound assertion, makes it easy to look for the beginnings aliases ends of words.
  • You tin usage logarithms pinch metrics to get a consciousness of the distribution of values for a section you’re willing in:
    const bucket = Math.floor(Math.log10(userInGroupCount)) metrics.increment("my_metric", { bucket });
  • Modern JS now supports Array.flatMap, Object.entries, and Promise.withResolvers.
  • In NodeJS, you tin support a relationship unfastened to an outer assets by creating an https.Agent and past providing it to your http requests: fetch(url, {method, agent}). This tin person a melodramatic effect connected latency.
  • git log -S shape (”git pickaxe”) tin springiness you each commits that added aliases removed a drawstring successful a codebase. It’s amazingly useful particularly pinch older codebases! (git log -G shape is similar, but will besides show erstwhile that statement was moved)
  • Similar to cd -, you tin usage git checkout - to cheque retired your erstwhile HEAD.
  • You astir apt don’t request find. A batch of find commands tin beryllium replaced pinch globs for illustration **/*.md. Most shells support this retired of the box, but pinch bash, you request to move this connected pinch shopt -s globstar.
  • In a akin vein, astir folks will astir apt want to usage rg (ripgrep) alternatively than grep, ack, aliases ag.
  • zsh’s precocious autocompletion features aren’t turned connected by default:
    if type brew &>/dev/null; then FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" fi autoload -Uz compinit compinit

You mightiness person already known each of these things! Or you mightiness activity successful a domain that makes each of these small tricks wholly useless. Even if this peculiar group of tricks isn’t useful for you, I stake you person your ain stash of tricks that you’ve accumulated complete the years that makes your activity easier.

At a company, I deliberation moreover much knowledge tends to beryllium this benignant of mini high-leverage nugget:

  • To debug $PROBLEM, usage $DATA_SOURCE.
  • $PERSON knows a ton astir $AREA and they’re happy to thief if you get stuck
  • There are bully docs astir $HARD_THING $OVER_HERE.
  • When $THING happens, it intends we should manually standard out.
  • To do a rolling restart of a service, tally $THIS_COMMAND.
  • This $UTIL makes $THAT_PROBLEM easy to script.

At a erstwhile company, I shared a instrumentality connected slack each time pinch the engineering team, some method and company-specific, and folks recovered them beautiful useful. Even if you knew 9/10 tricks, that 10th doc aliases method mightiness prevention you immoderate time! And 1 instrumentality per time was the correct number to debar overwhelming group pinch knowledge, and it could occasionally spark useful discussion. If you’re a much elder technologist astatine your company, you mightiness deliberation astir doing thing similar.

More