bin: various little script insertions

This commit is contained in:
xeruf 2022-09-16 14:48:43 +02:00
parent 2c1dab2a28
commit ae99fab61b
5 changed files with 6 additions and 4 deletions

View File

@ -80,6 +80,7 @@ fi
highlight "o :: optimize space extensively" highlight "o :: optimize space extensively"
if [[ $1 =~ "o" ]]; then if [[ $1 =~ "o" ]]; then
sudo rm -rf "$XDG_DATA_HOME/baloo" sudo rm -rf "$XDG_DATA_HOME/baloo"
docker image prune
which yay &>/dev/null && yay -Sc --noconfirm which yay &>/dev/null && yay -Sc --noconfirm
nix-collect-garbage -d nix-collect-garbage -d
nix-store --optimize nix-store --optimize

View File

@ -1,6 +1,6 @@
#!/bin/bash -e #!/bin/bash -e
# interactive diff with pagination and nice coloring # interactive diff with pagination and nice coloring
# TODO diff sqlite repos # TODO diff sqlite repos with sqldiff
if file --brief --mime "$1" "$2" | grep --quiet audio if file --brief --mime "$1" "$2" | grep --quiet audio
then ff() { ffprobe -loglevel warning -print_format default=noprint_wrappers=1 -show_format -pretty "$@"; } then ff() { ffprobe -loglevel warning -print_format default=noprint_wrappers=1 -show_format -pretty "$@"; }
$(test $(tput cols) -gt 120 && echo "diff --color=always --side-by-side" || echo "diff-color") --report-identical-files --label="$1" --label="$2" <(ff "$1") <(ff "$2") $(test $(tput cols) -gt 120 && echo "diff --color=always --side-by-side" || echo "diff-color") --report-identical-files --label="$1" --label="$2" <(ff "$1") <(ff "$2")

View File

@ -5,7 +5,7 @@
test "$1" = "-w" && write=true && shift test "$1" = "-w" && write=true && shift
disk="${1:-$(df --output=source . | tail -1)}" disk="${1:-$(df --output=source . | tail -1)}"
if test "$write" if test "$write"
then exec &> >(tee "disktest-$(date +%F)") then exec &> >(tee ".disktest-$(date +%F)")
fi fi
highlight() { echo "$1"; } highlight() { echo "$1"; }

View File

@ -18,7 +18,7 @@ showinfo() {
cmd="$1" cmd="$1"
case "$cmd" in case "$cmd" in
# TODO extract help in standard format from scripts # TODO extract help in standard format from scripts
(gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr|docker|jrnl|difft|wiked-diff) unbuffer "$@" --help | $paginate;; (rdoc|gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr|docker|jrnl|difft|wiked-diff) unbuffer "$@" --help | $paginate;;
(caddy|stretchly|go|fossil) test "$cmd" = "fossil" -a $# -eq 1 && repo="$(locate -b -l 1 "fossil*.fossil")" && fossil ui "$repo" && exit (caddy|stretchly|go|fossil) test "$cmd" = "fossil" -a $# -eq 1 && repo="$(locate -b -l 1 "fossil*.fossil")" && fossil ui "$repo" && exit
# TODO view fossil ui in terminal # TODO view fossil ui in terminal
shift shift

View File

@ -3,7 +3,8 @@
set -eo pipefail set -eo pipefail
_help="$0 <device> [mountpoint] [options...]" _help="$0 <device> [mountpoint] [options...]"
case $1 in case $1 in
("") arg=$(lsblk --list --noheadings --output name,label,fstype,mountpoint | ("") # TODO include size
arg=$(lsblk --list --noheadings --output name,label,fstype,mountpoint |
grep -v '/' | grep ".\+ [^ ]\+" | fzf --select-1 --exit-0 | grep -v '/' | grep ".\+ [^ ]\+" | fzf --select-1 --exit-0 |
sed "s/^\([^ ]\+ \+\)\?\([^ ]\+\) \+[^ ]\+ *$/\2/");; sed "s/^\([^ ]\+ \+\)\?\([^ ]\+\) \+[^ ]\+ *$/\2/");;
("--help") echo "$_help" && exit 0;; ("--help") echo "$_help" && exit 0;;