diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-05-10 22:57:02 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-05-10 22:57:02 +0200 |
| commit | 3cd9138c9d8fb9be248c75330cca9da47f4d2e8a (patch) | |
| tree | b3b677a9c1a474589f45d20953028a987fa73b80 /archive | |
| parent | 83f7fe4b8402bab171d110703a1b1115efbc9b28 (diff) | |
| download | bin-3cd9138c9d8fb9be248c75330cca9da47f4d2e8a.tar.gz bin-3cd9138c9d8fb9be248c75330cca9da47f4d2e8a.zip | |
added a whole bunch of scripts
Diffstat (limited to 'archive')
| -rw-r--r--[-rwxr-xr-x] | archive/bridge-sync.sh.bak | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | archive/create-lab | 0 | ||||
| -rw-r--r-- | archive/dm-recent-edit | 19 | ||||
| -rw-r--r--[-rwxr-xr-x] | archive/kvm-lab-create.bak | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | archive/kvm-lab-destroy.bak | 0 | ||||
| -rw-r--r-- | archive/rofi-notmuch | 26 | ||||
| -rw-r--r-- | archive/rofi-task-names | 26 | ||||
| -rw-r--r-- | archive/rofi-vim-power | 26 | ||||
| -rw-r--r-- | archive/timer.bak | 68 | ||||
| -rw-r--r--[-rwxr-xr-x] | archive/vm-new | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | archive/vm-rm | 0 |
11 files changed, 165 insertions, 0 deletions
diff --git a/archive/bridge-sync.sh.bak b/archive/bridge-sync.sh.bak index 7aecb75..7aecb75 100755..100644 --- a/archive/bridge-sync.sh.bak +++ b/archive/bridge-sync.sh.bak diff --git a/archive/create-lab b/archive/create-lab index 8640ed6..8640ed6 100755..100644 --- a/archive/create-lab +++ b/archive/create-lab diff --git a/archive/dm-recent-edit b/archive/dm-recent-edit new file mode 100644 index 0000000..583094f --- /dev/null +++ b/archive/dm-recent-edit @@ -0,0 +1,19 @@ +#!/usr/bin/env sh +# Pick a recently-edited file from vim's :oldfiles, open in st -e vim. +set -eu + +VIMINFO="${VIMINFO:-$HOME/.vim/.viminfo}" + +file=$( + vim -e -c "rviminfo! $VIMINFO" \ + -c 'redir >> /dev/stdout | silent oldfiles | redir END | qa!' \ + 2>/dev/null \ + | sed 's/^[[:space:]]*[0-9]*:[[:space:]]*//' \ + | sed "s|^~|$HOME|" \ + | awk 'NF && !seen[$0]++' \ + | while IFS= read -r f; do [ -f "$f" ] && printf '%s\n' "$f"; done \ + | dmenu -l 20 -i -p 'recent:' +) || exit 0 +[ -n "$file" ] || exit 0 + +exec st -e vim "$file" diff --git a/archive/kvm-lab-create.bak b/archive/kvm-lab-create.bak index 43d2926..43d2926 100755..100644 --- a/archive/kvm-lab-create.bak +++ b/archive/kvm-lab-create.bak diff --git a/archive/kvm-lab-destroy.bak b/archive/kvm-lab-destroy.bak index 3548ef9..3548ef9 100755..100644 --- a/archive/kvm-lab-destroy.bak +++ b/archive/kvm-lab-destroy.bak diff --git a/archive/rofi-notmuch b/archive/rofi-notmuch new file mode 100644 index 0000000..8fa5097 --- /dev/null +++ b/archive/rofi-notmuch @@ -0,0 +1,26 @@ +#!/bin/sh +set -eu + +DB="$HOME/.local/share/cheat-sheets/notmuch.tsv" + +[ -f "$DB" ] || exit 1 + +choice="$( + cat "$DB" | + rofi -dmenu -i -p 'Notmuch ›' +)" + +[ -n "${choice:-}" ] || exit 0 + +# First column = keystrokes +keys="$(printf '%s' "$choice" | cut -f1)" + +# Clipboard (Wayland/X11) +if command -v wl-copy >/dev/null 2>&1; then + printf '%s' "$keys" | wl-copy +elif command -v xclip >/dev/null 2>&1; then + printf '%s' "$keys" | xclip -selection clipboard +else + printf '%s\n' "$keys" +fi + diff --git a/archive/rofi-task-names b/archive/rofi-task-names new file mode 100644 index 0000000..965bb93 --- /dev/null +++ b/archive/rofi-task-names @@ -0,0 +1,26 @@ +#!/bin/sh +set -eu + +DB="$HOME/.local/share/cheat-sheets/task-tags.tsv" + +[ -f "$DB" ] || exit 1 + +choice="$( + cat "$DB" | + rofi -dmenu -i -p 'Naming conventions ›' +)" + +[ -n "${choice:-}" ] || exit 0 + +# First column = keystrokes +keys="$(printf '%s' "$choice" | cut -f1)" + +# Clipboard (Wayland/X11) +if command -v wl-copy >/dev/null 2>&1; then + printf '%s' "$keys" | wl-copy +elif command -v xclip >/dev/null 2>&1; then + printf '%s' "$keys" | xclip -selection clipboard +else + printf '%s\n' "$keys" +fi + diff --git a/archive/rofi-vim-power b/archive/rofi-vim-power new file mode 100644 index 0000000..3673119 --- /dev/null +++ b/archive/rofi-vim-power @@ -0,0 +1,26 @@ +#!/bin/sh +set -eu + +DB="$HOME/.local/share/cheat-sheets/vim-power.tsv" + +[ -f "$DB" ] || exit 1 + +choice="$( + cat "$DB" | + rofi -dmenu -i -p 'Vim power ›' +)" + +[ -n "${choice:-}" ] || exit 0 + +# First column = keystrokes +keys="$(printf '%s' "$choice" | cut -f1)" + +# Clipboard (Wayland/X11) +if command -v wl-copy >/dev/null 2>&1; then + printf '%s' "$keys" | wl-copy +elif command -v xclip >/dev/null 2>&1; then + printf '%s' "$keys" | xclip -selection clipboard +else + printf '%s\n' "$keys" +fi + diff --git a/archive/timer.bak b/archive/timer.bak new file mode 100644 index 0000000..fa8883c --- /dev/null +++ b/archive/timer.bak @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +# timer DURATION [MESSAGE...] +# examples: timer 25m "Pomodoro done" | timer 90s "Break over" + +set -euo pipefail + +dur="${1:-}" +shift || true +msg="${*:-Time is up}" + +if [ -z "$dur" ]; then + echo "usage: timer 25m \"Pomodoro done\" | timer 90s \"Break over\"" + exit 1 +fi + +# Parse duration: Ns or Nm (only) +case "$dur" in + *m) total=$(( ${dur%m} * 60 ));; + *s) total=$(( ${dur%s} ));; + *) echo "Bad duration: $dur (use e.g. 25m or 90s)"; exit 1;; +esac + +# Terminal helpers +cols=$(tput cols 2>/dev/null || echo 80) +barw=$(( cols - 22 )) +[ "$barw" -lt 10 ] && barw=10 + +hide_cursor() { tput civis 2>/dev/null || true; } +show_cursor() { tput cnorm 2>/dev/null || true; } +cleanup() { show_cursor; printf "\n"; } +trap cleanup EXIT INT TERM + +hide_cursor + +# ANSI colors (no external deps) +YELLOW=$'\033[33m' +GREEN=$'\033[32m' +DIM=$'\033[2m' +RESET=$'\033[0m' + +secs="$total" +start_msg="${msg}" + +while [ "$secs" -gt 0 ]; do + mm=$(( secs / 60 )) + ss=$(( secs % 60 )) + + done=$(( total - secs )) + pct=$(( done * 100 / total )) + + fill=$(( barw * done / total )) + empty=$(( barw - fill )) + + # Build progress bar + bar="$(printf "%${fill}s" "" | tr ' ' '=')" + pad="$(printf "%${empty}s" "")" + + printf "\r${YELLOW}T-%02d:%02d${RESET} ${DIM}[${bar}>${pad}]${RESET} %3d%% " \ + "$mm" "$ss" "$pct" + + sleep 1 + secs=$(( secs - 1 )) +done + +printf "\r${GREEN}DONE 00:00 100%%\n" +notify-send "Timer" "$start_msg" +paplay /usr/share/sounds/freedesktop/stereo/complete.oga >/dev/null 2>&1 || true + diff --git a/archive/vm-new b/archive/vm-new index 3955c6c..3955c6c 100755..100644 --- a/archive/vm-new +++ b/archive/vm-new diff --git a/archive/vm-rm b/archive/vm-rm index 3cbeb7d..3cbeb7d 100755..100644 --- a/archive/vm-rm +++ b/archive/vm-rm |
