Skip to content

Instantly share code, notes, and snippets.

@thcipriani
Created February 28, 2024 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thcipriani/6de5841f15a4808a4e01ddda42b2d41e to your computer and use it in GitHub Desktop.
Save thcipriani/6de5841f15a4808a4e01ddda42b2d41e to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
tail -n 10000 "$HOME/.muh_history" 2>/dev/null \
| awk '{for (i=5; i<=NF; i++)
printf "%s ",
$i;
print ""}' \
| sort \
| uniq -c \
| sort -n \
| awk '{$1=$1};1' \
| cut -d' ' -f2- \
| fzf --tac --query="$@" \
| python -c '
import sys
import fcntl
import termios
for b in sys.stdin.buffer.read():
fcntl.ioctl(sys.stdout.fileno(), termios.TIOCSTI, bytes([b]))'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment