Compare commits

...

3 commits

Author SHA1 Message Date
xeruf
02b22627ef config: text app preferences 2023-04-21 09:27:47 +02:00
xeruf
e7b634a002 bin: verbosify few scripts 2023-04-21 09:27:19 +02:00
xeruf
284f789aa2 bin: improve umoul handling 2023-04-21 09:26:34 +02:00
9 changed files with 72 additions and 49 deletions

View file

@ -1 +0,0 @@
../../.local/share/applications/signal-tray.desktop

View file

@ -611,6 +611,12 @@ Version 2019-11-04 2021-02-16"
"E" 'org-export-repeat
)
(defun org-export-disable-id ()
(interactive)
(defun my-link-remover (link contents info) contents)
(org-link-set-parameters "id" :export 'my-link-remover)
)
(setq org-html-style "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://gongzhitaao.org/orgcss/org.css\"/>"
org-html-head-include-default-style nil
org-html-htmlize-output-type 'css)

View file

@ -22,6 +22,14 @@ matches:
Technischer Leiter https://software-challenge.de, deutscher Programmierwettbewerb für Schüler
CTO der FTT Forensic Discovery GmbH - gesunde IT aus Bayreuth: https://forensicdiscovery.de
Software Engineering Student @ https://code.berlin
- trigger: ";grer"
replace: |-
Greetings from Bavaria,
Janek
---
CTO https://forensicdiscovery.de and https://software-challenge.de
Software Engineering Student @ https://code.berlin
- trigger: ";date"
replace: "{{mydate}}"
vars:

View file

@ -504,16 +504,12 @@ else
alias f1='find -mindepth 1 -maxdepth 1'
fi
lowercase() {
#$(which perl-rename || echo rename) -iv 'y/A-Z /a-z-/' "$@"
find "$@" -exec sh -c 'mv -iv "{}" "$(echo "{}" | tr "A-Z " "a-z-" | sed "s|---|_|;s|\.-|.|")" 2>/dev/null' \;
}
# TODO replace cp by rsync, automatically use compression for remote transfers
# rsync directory properly - suffix both dirs with / to act on contents
alias rcn='rsync -v --recursive --human-readable --links --dry-run'
rcd() { rcn --size-only "$@" | tail +2 | tree --fromfile . | less -F; }
compdef rcd=rsync
# TODO do not sync times to FAT
alias rc='rcs --links --hard-links --times'
alias rcu='rc --existing --size-only'
alias rcs='rsync --recursive --info=progress2,remove,symsafe,flist,del --human-readable'
@ -571,8 +567,8 @@ compdef mkcd=mkdir
# Other stuff {{{1
alias unmount=umoul
# This is a function rather than a script as it potentially needs to cd out
# if the current directory is the one to unmount
# This is a function rather than a script as it needs to cd up
# if the current directory is to be unmounted
umoul() {
local arg
local mnt="${MNT:-${XDG_RUNTIME_DIR}/mnt}"
@ -580,7 +576,7 @@ umoul() {
for arg; do true; done
case "$arg" in
(-a|--all)
mountpoints=$(mount | grep "$mnt" | cut -d' ' -f3)
mountpoints="$(mount | grep "$mnt" | cut -d' ' -f3)";;
("")
mountpoints="$(pwd | grep -v /home || echo /)"
while test "$mountpoints" != "/"; do
@ -592,21 +588,23 @@ umoul() {
grep --invert-match -e " /[^m][^/]*\(/[^/]*\)\? " -e "/sys" -e "/run/user" -e "/run/docker" -e "/home" |
fzf --exit-0 | awk '{print $3}')" ||
return $?
;;
(*)
mountpoints="$(test -d "$arg" && realpath "$arg" || echo "$mnt/$arg")"
mountpoint "$mountpoints" 2>/dev/null || test -b "$mountpoints" ||
mountpoints="$(mount --show-labels | grep "$arg" | cut -d' ' -f3)"
test "$mountpoints" || return 1
;;
esac
# pass on all args except last
for mountpoint in $mountpoints; do
while true; do
case "$PWD" in
("$mountpoints"*) popd || builtin cd "$(dirname $mountpoints)";;
("$mountpoint"*) popd || builtin cd "$(dirname "$mountpoint")";;
(*) break;;
esac
done
# pass on all args except last
for mountpoint in $mountpoints
do moul -u "${@:1:$(((# > 1) ? #-1 : 0))}" "$mountpoint"
moul -u "${@:1:$(((# > 1) ? #-1 : 0))}" "$mountpoint"
done
}

View file

@ -1,3 +1,3 @@
#!/bin/sh -ex
# Set exec flag on all files that should be executable
find -maxdepth 4 -name "*.sh" "$@" -exec chmod +x {} +
find -maxdepth 4 -name "*.sh" "$@" -exec chmod -v +x {} +

View file

@ -5,6 +5,11 @@
# and shows progress indications for some operations
# optdepends: rewrite(part of my dotfiles, for unzip line rewriting) 7z p7zip unzip
# TODO auto-delete archive, auto-extract in current dir, trim .tar.gz fully
if test $# -eq 0
then ex *.zip
exit
fi
for arg do
case $arg in
(-d) del=$(expr ${del:-0} + 1);;

View file

@ -1,3 +1,5 @@
#!/bin/sh
# Lowercase given files
perl-rename 'y/A-Z /a-z-/' "$@"
#perl-rename 'y/A-Z /a-z-/' "$@"
#$(which perl-rename || echo rename) -iv 'y/A-Z /a-z-/' "$@"
find "$@" -exec sh -c 'mv -iv "{}" "$(echo "{}" | tr "A-Z " "a-z-" | sed "s|---|_|;s|\.-|.|")" 2>/dev/null' \;

View file

@ -1,4 +1,4 @@
#!/bin/sh -x
#!/bin/sh
# Mount a partition by label or device identifier automatically
# Includes interactive selection if no argument is given
set -eo pipefail
@ -8,11 +8,14 @@ case $1 in
bash -x "$0" "$@";;
("") # TODO include size
arg=$(
{ #for ip in $(sudo nmblookup -S \* | grep '^[0-9]' | cut -d' ' -f1)
{
#for ip in $(sudo nmblookup -S \* | grep '^[0-9]' | cut -d' ' -f1)
#do timeout --kill-after=.1s .1s showmount --no-headers --exports "$ip" 2>/dev/null | sed "s|\([^ ]*\) .*|$ip:\1|"
#done &
lsblk --list --noheadings --output name,label,fstype,mountpoint | grep -v LUKS | grep -v '/' | grep ".\+ [^ ]\+"; } | fzf --exit-0 |
sed "s/^\([^ ]\+ \+\)\?\([^ ]\+\) \+[^ ]\+ *$/\2/");;
# TODO handle labels with spaces
lsblk --list --noheadings --output name,label,fstype,mountpoint | grep -v LUKS | grep -v '/' | grep ".\+ [^ ]\+";
} | fzf --exit-0 | sed "s/^\([^ ]\+ \+\)\?\([^ ]\+\) \+[^ ]\+ *$/\2/"
);;
(--help) echo "$_help" && exit 0;;
(-u) shift
for last; do true; done
@ -47,14 +50,15 @@ fi
case "$arg" in
(sd*|loop*|nvme*|mm*|md*|dm*|vg*) partition="/dev/$arg";;
(/dev/*) partition="$arg";;
(*) partition="-L $arg";;
(*) params="-L"
partition="$arg";;
esac
shift $(expr 2 \& $# \> 2 \| $#)
#uid=$(id --user),gid=$(id --group), \
if ! mountpoint "$mountpoint" 2>/dev/null
then mp="/run/media/$USER/$arg" && test -e "$mp" && mountpoint="$mp"
sudo mount -vo users,X-mount.mkdir,noatime,umask=003,gid=users,uid=$USER $partition $mountpoint "$@" ||
sudo mount -vo users,X-mount.mkdir,noatime $partition $mountpoint "$@"
sudo mount -vo users,X-mount.mkdir,noatime,umask=003,gid=users,uid=$USER $params "$partition" "$mountpoint" "$@" ||
sudo mount -vo users,X-mount.mkdir,noatime $params "$partition" "$mountpoint" "$@"
fi
cd $mountpoint
exec $SHELL

View file

@ -23,6 +23,7 @@ export TEXMF=""
pdfjam $quiet "$signature" --outfile "$sig" --papersize "{595pt, 842pt}" --noautoscale true \
--offset "${h}pt ${v}pt" --scale "${4:-1}"
pdfjam $quiet "$1" last "$sig" --outfile "$tmp_signed" --delta "0 -842pt" --nup "1x2" --fitpaper true
# TODO consider pdftk stamp
timg "$tmp_signed"