grep = "grep --color";
j = "sudo journalctl -u";
jb = "sudo journalctl -b";
+ ju = "sudo journalctl --user -u";
l = "ls -alh";
ll = "ls -al";
ls = "ls --color=tty";
w10 = "watch --color --differences --interval 10";
w = "watch --color --differences";
watch = "watch --color --differences";
- yt = "yt-dlp";
zfs-umount = "zfs-unmount";
};
sessionVariables = {
mkpass () {
tr -d -C 'A-Za-z0-9' </dev/urandom | head -c 25 | xclip
}
+ opusenc-voice () {
+ find "$@" -depth -type f -print0 | sort -n -z |
+ xargs -0 -P "$(lscpu --online -p | grep -v "#" | wc -l)" -I {} bash -c '
+ test -e "''${0%.*}".opus ||
+ nice -n 19 ffmpeg -y -i "$0" -map 0:a -b:a 32k -application voip "''${0%.*}".opus
+ ' {} \;
+ }
smartctl-tbw () {
device=''${1:-/dev/sda}
sudo smartctl -A $device |
}
edit-in-commit () { $EDITOR $(git diff-tree --no-commit-id --name-only -r "$@"); }
edit-in-git-grep () { $EDITOR $(git grep --name-only --recursive "$@"); }
- zfs-mount () { for d in $(zfs list -rH -o name "$@"); do sudo zfs mount -l "$d"; done; }
+
+ # Recursively mount not-mounted dataset,
+ # loading their keys if needed.
+ zfs-mount () {
+ for d in $(zfs list -rH -o name "$@"); do
+ mountpoint /mnt/"$d" 2>/dev/null ||
+ sudo zfs mount -l "$d"
+ done
+ }
+ # Recursively unmount dataset,
+ # unloading their keys.
zfs-unmount () { sudo zfs unmount -u "$@"; }
+
+ # Restore the inheritance of encryptionroot,
+ # usually broken by zfs send --raw.
+ # Note that it needs to decrypt the datasets.
+ zfs-fix-encryptionroot () {
+ zfs load-key "$1"
+ for i in $(zfs list -rHo name "$1" | tail -n +2); do
+ echo >&2 "$i"
+ test "$(zfs get -Ho value encryptionroot $i)" = "$1" ||
+ zfs change-key -li "$i"
+ done
+ }
'';
profileExtra = ''
'';