This commit is contained in:
caandt 2025-12-29 01:03:45 -06:00
parent 772dc05def
commit eb759e0e2c
7 changed files with 69 additions and 2 deletions

View file

@ -22,6 +22,10 @@ lib.mkIf (config.networking.hostName != "komikan") {
user = "1000";
mode = "0755";
};
"/mnt/tmp".d = {
user = "1000";
mode = "0755";
};
};
fileSystems."/mnt/pool" = {
device = "//komikan/pool";

View file

@ -11,6 +11,7 @@ in {
edit = [];
auto-tmux = [tmux];
sm = [];
rem = [fzf];
}
// lib.optionalAttrs config.u.has.graphical {
bell = [pipewire libnotify];

35
user/bin/rem Executable file
View file

@ -0,0 +1,35 @@
#!/bin/sh
# things you should remember but dont
REM="${XDG_DATA_HOME:=$HOME/.local/share}/rem.cmd"
if ! [ -f "$REM" ]; then
echo "missing $REM"
exit 1
fi
cmd="$(cat $REM | fzf -e -q "$1" -1 -d "^" --with-nth="{1}" --accept-nth="{2..}")"
rest="$cmd"
final=""
prompt() {
if [ -z "$2" ]; then
while [ -z "$output" ]; do
read -E -p "$1: " output
done
else
read -E -p "$1 ($2): " output
fi
printf "%s" "${output:-$2}"
}
while case "$rest" in *\{\{*\}\}*) true;; *) false;; esac; do
prefix="${rest%%\{\{*}"
temp="${rest#*\{\{}"
cmd="${temp%%\}\}*}"
rest="${temp#*\}\}}"
final="$(printf "%s%s%s" "$final" "$prefix" "$(eval "$cmd")")"
done
final="$(printf "%s%s" "$final" "$rest")"
printf "%s" "$final"

View file

@ -51,7 +51,7 @@ if [[ "$TERM" != "linux" ]]; then
# check if still in .bashrc
if declare -F _bashrc_main > /dev/null; then
return
elif [[ "$@" != @("starship_precmd"|""|"__fzf_history__"|"fzf-file-widget"|"history -a"|"__zoxide_hook") ]]; then
elif [[ "$@" != @("starship_precmd"|""|"__fzf_history__"|"fzf-file-widget"|"history -a"|"__zoxide_hook") && ! "$@" =~ _comp.* ]]; then
printf "\e]0;%s | %s | %s\a" "$(dirs +0)$_set_title_suffix" "$@" "$(date +"%H:%M:%S")"
fi
}

View file

@ -80,3 +80,18 @@ function venv() {
done
echo "not found"
}
function _comp_rem_binding() {
local tty="$(stty -g)"
stty sane
READLINE_LINE="$(rem "$_comp_rem_arg")"
READLINE_POINT=${#READLINE_LINE}
stty "$tty"
}
function _comp_rem() {
COMPREPLY=""
_comp_rem_arg="${COMP_WORDS[@]:1}"
bind -x '"\e[0n": _comp_rem_binding'
printf '\e[5n' > /dev/tty
}
complete -F _comp_rem rem

View file

@ -1,4 +1,4 @@
{...}: {
{config, ...}: {
imports = [
./nsxiv-rifle.nix
];
@ -14,4 +14,5 @@
force = true;
};
xdg.dataFile."kwalletd".source = ./kwalletd;
xdg.dataFile."rem.cmd".source = config.u.lib.lnn "user/share/rem.cmd";
}

11
user/share/rem.cmd Normal file
View file

@ -0,0 +1,11 @@
YUBIKEY: get ssh key from yubikey^ssh-keygen -K
YUBIKEY: enable pam u2f^mkdir -p ~/.config/Yubico && pamu2fcfg >> ~/.config/Yubico/u2f_keys
NIXOS: update nixos system^nixos-rebuild switch --flake ~/.local/nixos --show-trace --sudo
NIXOS: update home manager^home-manager switch --flake ~/.local/nixos --show-trace
NIXOS: list generations^nix-env --list-generations
NIXOS: delete old generations^nix-env --delete-generations +{{prompt "keep last n" "5"}}
SSH: access remote port at local port^ssh -L {{prompt "remote port"}}:localhost:{{prompt "local port"}} -T -N {{prompt "remote"}}
SSH: socks proxy^ssh -D {{prompt "port to use" "5555"}} -q -C -N -f {{prompt "remote"}}
SSH: mount with sshfs^sshfs {{prompt "remote host:/dir"}} {{prompt "target" "/mnt/tmp"}} -o uid={{id -u}} -o gid={{id -g}}
TOOL: ocr^maim -su | tesseract - -
MONITOR: disable auto sleep^xset s off -dpms