config/shell: little adjustments

This commit is contained in:
xeruf 2021-11-14 14:25:34 +01:00
parent 91582b036d
commit 7d80a75276
4 changed files with 10 additions and 9 deletions

View File

@ -60,13 +60,13 @@ formatsongs() {
_pwd="$PWD"
find "$PWD" "$@" -type d | while read d; do builtin cd $d; findsongs | while read song; do
new="$(formatsong "$song")"
test "$new" != "$song" && mv -v "$song" "$new"
test "$new" && test "$new" != "$song" && mv -iv "$song" "$new"
done; done
builtin cd "$_pwd"
IFS=$'\n'
for f in $(find "$@" -name "*.wav"); do
echo "Converting $f to ${f%.*}.flac"
ffmpeg -i "$f" "${f%.*}.flac" -v warning && rm -v $f
ffmpeg -i "$f" "${f%.*}.flac" -v warning && mv -v $f /tmp
done
unset IFS
}
@ -77,11 +77,12 @@ formatsong() {
s/ \((Original Mix)\|(Original)\|(Full Stream)\|.NCS Release.\)//i;
s/ (\(Acoustic\|Live\))/ [\1]/i;
s/ \[\(feat.*\)\]/ (\1)/i;
s/^\([A-z]\+\) The \([^-]\+\)$/\1, the \2/g;
s/ \(\..\{2,4\}\)$/\1/;
s/---/ - /;
s/^[0-9]\{6\}_//;
s/ / /g;
s/_\././g;
s/_/ /g;
s/ \././g;
s/ / /g;
s/\(\w\)+\(\w\)/\1 \2/g' -
}

View File

@ -1,5 +1,5 @@
#!/bin/sh
test -r "$1" || (echo "Usage: sign <document.pdf> [hoffset [voffset [scale [alt-signature]]]]" && exit 1)
test ! -r "$1" && echo "Usage: sign <document.pdf> [hoffset [voffset [scale [alt-signature]]]]" && exit 1
signature=$(pass information/signature$(test -n "$5" && echo "-$5"))
@ -15,6 +15,8 @@ pdfjam "$signature" --outfile "$sig" --papersize "{595pt, 842pt}" --noautoscale
--offset "${2:-0}pt ${3:-0}pt" --scale "${4:-1}"
pdfjam "$1" last "$sig" --outfile "$tmp_signed" --delta "0 -842pt" --nup "1x2" --fitpaper true
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
@ -22,5 +24,3 @@ if test "$(pdftk "$1" dump_data | grep Pages | cut -d' ' -f2)" -gt 1
pdfjam "$tmp_reversed" last-2 "$tmp_signed" --outfile "$result"
else cp "$tmp_signed" "$result"
fi
xdg-open "$result"

View File

@ -49,8 +49,8 @@ export TASKRC="$XDG_CONFIG_HOME/task/taskrc"
export TASKDATA="$XDG_DATA_HOME/task"
# zsh dirs
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export ZSH="$XDG_DATA_HOME/zsh/oh-my-zsh"
export HISTFILE="$XDG_STATE_HOME/zsh/history"
export ZSH="$XDG_STATE_HOME/zsh/oh-my-zsh"
export CONFIG_ZSH="$XDG_CONFIG_HOME/zsh"
export CONFIG_SHELLS="$XDG_CONFIG_HOME/shell"

View File

@ -55,7 +55,7 @@ and configuration for ~less~ and ~fzf~.
** Graphical
- x :: xorg-xserver xorg-xkill xorg-setxkbmap xorg-xinit xterm xclip xprintidle light
- music production :: lilypond lilypond-docs timidity++ chordpro-git musescore
- video :: vlc kdenlive
- video :: vlc obs-studio kdenlive
- kde :: plasma-desktop plasma-nm spectacle breeze systemsettings konsole ktorrent dolphin kdeplasma-addons kinfocenter partitionmanager kdeconnect kwallet-pam kwalletmanager ksshaskpass okular bluedevil
- office :: emacs texlive-core texlive-latexextra context-bin libreoffice-fresh
- hacking :: etcher-bin