bin: parameter tweaks

This commit is contained in:
xeruf 2024-04-08 13:02:09 +02:00
parent 490f50695b
commit b2e64b6555
10 changed files with 18 additions and 9 deletions

View File

@ -32,7 +32,7 @@ shift "$(($OPTIND -1))"
checkperm() {
checkaccess -r "$@" || elevate=sudo
mime="$(test -n "$shifted" || $elevate file --dereference --mime -- "$@")"
mime="$(test -n "$shifted" || $elevate file --dereference --mime-type -- "$@")"
}
fileinfo() {
tput setaf 4
@ -79,7 +79,7 @@ for arg; do
tmpfile="$prefix/$(basename -- "$arg")_$(dd "if=$arg" bs=512 count=10 2>/dev/null | md5sum | tr -d ' ' || true)"
mkdir -p "$prefix"
case "$mime" in
(*\ application/pdf\;*)
(*\ application/pdf)
grid=$(expr $(tput cols) \* $# / $(tput lines))
grid=$(expr 3 \& $grid \< 3 \| $grid)
#limit=$(expr $grid \& \( $grid \> 3 \| $# \> 1 \) \| $grid '*' 2)
@ -101,6 +101,7 @@ for arg; do
timg+=("$tmpfile");;
# TODO .raw .img
(*/x-iso*|*/x-qemu-disk*) fdisk -l "$arg";;
(*/vnd.android.package-archive) aapt dump badging "$arg" | grep package | cut -d' ' -f2-;;
(*\ video/*)
suffix=_thumbs.jpg
! $inspect &&
@ -113,7 +114,7 @@ for arg; do
(*\ image/*)
timg+=("$arg")
which identify >/dev/null && continue;;
(*\ inode/directory\;*)
(*\ inode/directory)
ls+=("$arg")
test -L "$arg" || continue
;;

View File

@ -3,6 +3,7 @@
# Usage: bag [-n] [--dry-run] [--home] [--root MOUNTED_ROOT]
root="/"
args="--progress --stats"
case $BORG_REPO in (*:*) run=borg;; esac
while test $# -gt 0; do
case "$1" in
(-n) run="arg-test"; shift;;

View File

@ -78,7 +78,7 @@ highlight "c :: clean electron caches"
highlight "o :: optimize space extensively"
if [[ $1 =~ "o" ]]; then
sudo find /root/.cache $XDG_CACHE_HOME /var/cache /var/log /var/tmp -mindepth 1 -maxdepth 2 -atime +2 -exec rm -r {} + -prune
sudo find /root/.cache $XDG_CACHE_HOME /var/cache /var/log /var/tmp -not -name CACHEDIR.TAG -mindepth 1 -maxdepth 2 -atime +2 -exec rm -r {} + -prune
if test -f "/var/log/apt/history.log"; then
aptclean_cur=$(cat "/var/log/apt/history.log" | wc -l)

View File

@ -26,6 +26,6 @@ fi
if test "$command"; then
echo "Generated through $command"
$(test $(tput cols) -gt 120 && echo "diff --color=always --side-by-side" || echo "diff-color") \
--report-identical-files --label="${files[0]}" --label="${files[1]}" <($command "${files[0]}") <($command "${files[1]}")
--ignore-case --report-identical-files --label="${files[0]}" --label="${files[1]}" <($command "${files[0]}") <($command "${files[1]}")
fi
} | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen

View File

@ -20,7 +20,7 @@ case $host in
(hub|github) host=git@github.com;;
(lab) host=git@gitlab.com;;
(jf) host=gitea@git.jfischer.org;;
(ftt|"") host=git@code.ftt.gmbh; user=janek;;
(ftt|"") host=git@forge.ftt.gmbh; user=janek;;
esac
user=${3:-${user:-$(git config user.name)}}
repo=${2:-$(basename $(git root))}

View File

@ -2,7 +2,7 @@
# Find terms in jrnl files and turn them into tags
# Check with jrnl --tags
if test $# -eq 0
then $0 sleep nap health tech read dev phone Zinc run bike tour laptop computer PC CB piano faith journal
then $0 sleep uni work nap health tech read girl dev phone Zinc run bike tour laptop computer PC CB piano faith journal Catherine Franklin Kerstin Henri Katja
else
for arg
do rpl "\(^\|[^@]\)\b$arg\b" "\1@$arg" $JOURNAL/*.txt 2>/dev/null

View File

@ -72,4 +72,5 @@ then mp="/run/media/$USER/$arg" && test -e "$mp" && mountpoint="$mp"
sudo mount -vo users,X-mount.mkdir,noatime $params "$partition" "$mountpoint" "$@"
fi
cd $mountpoint
df -x tmpfs -x devtmpfs -x squashfs --human-readable
exec $SHELL

6
.local/bin/scripts/mpq Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh -e
# MPC add file to queue
for arg
do fullpath=$(realpath "$arg")
mpc insert "${fullpath/$MUSIC\//}"
done

View File

@ -2,4 +2,4 @@
#for app in wordpress nextcloud velero vikunja ninja
#do stack user setrole
#done
pass business/ftt/invite | envsubst | ssh nc-iridion sudo sendmail -v "$mail"
pass business/ftt/invite"$1" | envsubst | ssh nc-iridion sudo sendmail -v "$mail"

View File

@ -243,7 +243,7 @@ metadata:
namespace: flux-system
spec:
fields:
- fieldname: password
- fieldName: password
EOF
cat <<EOF >"$app-secrets/$app-oauth-secret.yaml"
---