Sort committers by average length of commit message

git log --no-merges --pretty=format:'COMMIT_START|%an|%B|COMMIT_END' | \
awk '
BEGIN { RS = "COMMIT_END\n"; FS = "|" }
/COMMIT_START/ {
    author = $2
    message = ""
    for (i = 3; i <= NF; i++) {
        if (i > 3) message = message "|"
        message = message $i
    }
    len = length(message)
    authors[author] += len
    counts[author]++
    if (!min[author] || len < min[author]) min[author] = len
    if (len > max[author]) max[author] = len
}
END {
    for (author in authors) {
        avg = authors[author] / counts[author]
        printf "%6.1f|%-30s|(min: %d, max: %d, commits: %d)\n",
               avg, author, min[author], max[author], counts[author]
    }
}' | sort -t'|' -k1 -nr | awk -F'|' '{printf "%-30s %s chars %s\n", $2, $1, $3}'

Gradient Borders with Transparent Background

<html lang="en">
<head>
<title>Gradient borders with transparent background</title>
<meta charset="utf-8">
<style>
* {
  box-sizing: border-box;
}

body {
  background-color: black;
  color: white;
}

.card {
  background-color: gray;
  color: black;
}

.gradient-border-mask {
  display: flow-root;
  position: relative;
  padding: 1.3rem;
}

.gradient-border-mask::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 5px;
  border: 5px solid transparent;
  background: linear-gradient(45deg, purple, orange) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
}
</style>

</head>
<body>

<div class="gradient-border-mask">
  <p>Lorem ipsum dolor sit amet consectetur</p>
</div>

<div class="card">
  <p>Lorem ipsum dolor sit amet consectetur</p>
  <div class="gradient-border-mask">
    <p>Lorem ipsum dolor sit amet consectetur</p>
  </div>
</div>

</body>
</html>

How to keep your input and dismiss/cancel atuin

The normal behavior of atuin is to put either the command you matched onto your commandline, or nothing. So if you Ctrl-r and type something with no good match and exit, you “lose” what you have typed. You can Ctrl-g to get back what you had when you pressed Ctrl-r but anything you typed after that is lost.

To get what I think is superior behavior set exit_mode = "return_query" in ~/.config/atuin/config.toml. Now whatever is in the atuin buffer is now on your commandline if you hit Esc. You can still Ctrl-g to get what you had before Ctrl-r or Ctrl-c to exit to an empty commandline.

Starting more than one dev webserver each in its own terminal window (Mac)

#!/usr/bin/env zsh
# Script to start monorepo development processes in separate terminals
open_position_run() {
  local dir=$1
  local cmd=$2

  # Start the server
  osascript -e 'tell application "Terminal"
    do script "cd '"$dir"' && nvm use 20 && '"$cmd"' &" in window 1
  end tell'
}

open_position_run "/Users/bakert/monorepo/apps/app1 "pnpm dev"
open_position_run "/Users/bakert/monorepo/apps/app2 "pnpm dev"