Compare commits

...

2 commits

Author SHA1 Message Date
xeruf
89790fdd10 config/doom: mode snippets 2023-05-09 14:03:21 +02:00
xeruf
027ab59aab bin: improve scripts 2023-05-09 14:02:32 +02:00
9 changed files with 61 additions and 26 deletions

View file

@ -72,7 +72,7 @@ Version 2019-11-04 2021-02-16"
(defun xf/org-journal-current ()
(interactive)
(org-journal-open-current-journal-file)
(goto-char (point-max))
;(goto-char (point-max))
)
;; rebing C-u - https://emacs.stackexchange.com/a/58320
@ -923,7 +923,7 @@ Version 2019-11-04 2021-02-16"
(add-to-list 'auto-mode-alist '("\\.jrnl\\'" . org-mode))
(add-to-list 'auto-mode-alist '("\\.el##" . emacs-lisp-mode))
;(add-to-list 'auto-mode-alist `(,(getenv "CONFIG_SHELLS") . sh-mode))
(add-to-list 'auto-mode-alist `(,(getenv "CONFIG_SHELLS") . sh-mode))
;(add-to-list 'auto-mode-alist `(,(getenv "CONFIG_ZSH") . sh-mode))
(add-to-list 'auto-mode-alist `("\\.local/bin" . sh-mode))

View file

@ -4,15 +4,17 @@
\header {
title = "${1:`(upcase-initials (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`}"
%%subtitle = ""
composer = "Janek Fischer"
%%composer = "Janek Fischer"
arranger = "Janek Fischer"
}
\version "2.22.2"
\version "2.24.1"
\score {
<<
\time 4/4
%%% Chords
\new ChordNames {
\set chordChanges = ##t
\set majorSevenSymbol = \markup { maj7 }
\chordmode {
c,,1\p
}

View file

@ -2,8 +2,8 @@
# Check the first file against all other ones given and print duplicates.
# Checks first size then diff.
# TODO diff initial bytes
if ! test $# -lt 2
then echo "Need at least 2 files to compare!" 2>/dev/null
if test $# -lt 2
then echo "Need at least 2 files to compare!" >&2
exit 2
fi
target="$1"

View file

@ -3,13 +3,22 @@
# which exist elsewhere as listed by locate.
# Args: [threshold (MB)] <filepaths...>
# OptDepends: synct (for checking against original filename)
case $1 in ([0-9]|[0-9][0-9]) threshold=$1; shift;; esac
find "$@" -size +${threshold:-50}M -type f -exec sh -c "IFS=$'\n'"'
filepath="{}"
target="$(synct-unarchive "$filepath" || echo "$filepath")"
highlight "$filepath"
for existing in $(locate -b "$target")
do test -n "$(dupcheck "$target" "$existing") &&
echo "Duplicate found at $existing"
rm -vi "$filepath" && break
while test $# -gt 0; do
case "$1" in
([0-9]|[0-9][0-9]) threshold=$1;;
(-n) noscan=$1;;
(-v) verbose=$1; set -x;;
(*) break;;
esac
shift
done
test "$noscan" || "Updating Locate Database..." && sudo updatedb
find "$@" -size +${threshold:-50}M -type f -exec sh -c "IFS=$'\n'; verbose='$verbose'"'
target="$(synct-unarchive "{}" || echo "{}")"
highlight "{}"
for existing in $(locate -b "$(basename "$target")")
do test "$verbose" && echo "Checking $existing against {}"
test -n "$(dupcheck "{}" "$existing")" &&
echo "Duplicate found at $existing" &&
rm -vi "{}" && break
done' \;

3
.local/bin/scripts/nas Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh -e
cd /mnt/nas
find -mindepth 1 -maxdepth 1 -exec mount {} \;

View file

@ -5,4 +5,5 @@ pkill --echo --ignore-case discord
pkill --echo signal
pkill --echo aw-server
pkill --echo aw-qt
systemctl stop --user syncthing plasma-baloorunner kde-baloo openvpn-client@deltaPeak.service
systemctl stop --user syncthing plasma-baloorunner kde-baloo
systemctl stop openvpn-client@deltaPeak.service

View file

@ -1,6 +1,7 @@
#!/bin/sh -ex
test "$1" = "-q" && quiet=$1 && shift
test ! -r "$1" && echo "Usage: sign <document.pdf> [hoffset (-160) [voffset (-310) [scale [signature-image]]]]" && exit 1
case "$1" in ([0-9]) page=$1; shift;; esac
test ! -r "$1" && echo "Usage: sign [page] <document.pdf> [hoffset (-160) [voffset (-310) [scale [signature-image]]]]" && exit 1
signature=$(pass info/signature$(test -n "$5" && echo "-$5") || echo "$5")
@ -22,15 +23,18 @@ fi
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
pdfjam $quiet "$1" ${page:-last} "$sig" --outfile "$tmp_signed" --delta "0 -842pt" --nup "1x2" --fitpaper true
# TODO consider pdftk stamp
timg "$tmp_signed"
# https://apple.stackexchange.com/questions/198854/shell-command-to-count-pages-in-a-pdf-other-than-pdftk
if test "$(pdftk "$1" dump_data | grep Pages | cut -d' ' -f2)" -gt 1
then
if test "$page"
then pdfjam $quiet "$1" 1-$(expr $page - 1) "$tmp_signed" 1 "$1" $(expr $page + 1)-last --outfile "$result"
elif test "$(pdftk "$1" dump_data | grep Pages | cut -d' ' -f2)" -gt 1
then
pdfjam $quiet "$1" last-1 --outfile "$tmp_reversed"
pdfjam $quiet "$tmp_reversed" last-2 "$tmp_signed" --outfile "$result"
else cp "$tmp_signed" "$result"
else cp "$tmp_signed" "$result"
fi

2
.local/bin/scripts/topng Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
convert -background white -density 500 "$@" "$1.png"

View file

@ -2,18 +2,32 @@
# Update an Easy2Boot USB Stick after adding ISOs
# Call with Linux ISOs to be copied as args
# Need to be around E2B mountpoint if it is not the default
if ! dir="$(find . "${MNT:-${XDG_RUNTIME_DIR}/mnt}" -maxdepth 3 -name _ISO -type d | grep .)"
if ! dir="$(find . "${MNT:-${XDG_RUNTIME_DIR}/mnt}" -maxdepth 3 -name _ISO -type d | grep --max-count 1 .)"
then echo "Please mount your multiboot stick first!"
exit 1
fi
cmd=mv
cmd=cp
case $1 in
(-upgrade) upgrade=$2; shift 2;;
(-cp) cmd=cp; shift;;
(-mv) cmd=mv; shift;;
esac
test $# -eq 0 || $cmd -vi "$@" "$dir/LINUX"
find "$dir" -type f -iname "*32-*.iso" -exec mv -vi {} {}def32 \;
find "$dir" -type f -name "*.iso" -exec mv -vi {} {}def64 \;
drive=$(mount | grep "$(dirname "$dir")" | cut -d' ' -f1)
sudo umount $drive
sudo udefrag $drive
mountdir="$(dirname "$dir")"
drive=$(mount | grep "$mountdir" | cut -d' ' -f1)
sudo umount "$drive"
if test "$upgrade"; then
echo "Do you want to reformat $drive as NTFS? (Ctrl-C to abort)"
read
mkfs -t ntfs "$drive"
ntfslabel "$drive" "E2B"
sudo mount "$drive" "$mountdir"
unzip "$upgrade" -d "$mountdir"
touch -v "$dir/nodelay.txt"
cp -v /mnt/nas/media/iso/utilities/*.iso "$dir/UTILITIES"
else
sudo udefrag -m "$drive"
fi