bin: lots of improvements, bells and whistles

This commit is contained in:
xeruf 2022-10-13 21:57:22 +02:00
parent 0988225c09
commit c977342d5e
10 changed files with 35 additions and 10 deletions

View File

@ -37,6 +37,7 @@ cache/
*_build/
cmake*build*/
__pycache__/
node_modules/
# Logs
*.log

View File

@ -15,7 +15,7 @@ let @t = ':%s/^\(\(\t\)*\) /\1\t/g :%s/^\(\(\t\)*\) /\1\t/g :%s/^\(\(\t\)*\)
" Sane yanking
map Y y$
" Disable Ex mode - https://vi.stackexchange.com/q/457
nnoremap Q @q
nnoremap Q :wqa<CR>
noremap q: <Nop>
" Alias replace all to S

View File

@ -204,7 +204,7 @@ if test "$bat" -o "$batplain"; then
if which cj >/dev/null; then
json=true
for file in "${bat[@]}"; do
case $file in (*.json);; (*) json=false;; esac
case $file in (*.json|*.geojson);; (*) json=false;; esac
done
fi
if $json
@ -228,7 +228,7 @@ if test "$ls" -o $# -le $(echo "$flags" | wc -w); then
if test '$tree'
then $elevate tree -a --dirsfirst --du -h -C -L 3 $flags $(printf "'%s' " "${ls[@]:-.}")
elif which exa 2>/dev/null >&2
then $elevate exa --color=always --long --group --classify --all --all --sort=changed --reverse $flags $(printf "'%s' " "${ls[@]:-.}")
then $elevate exa --icons --color=always --long --group --classify --all --all --sort=changed --reverse $flags $(printf "'%s' " "${ls[@]:-.}")
else $elevate ls -l $(test $# -gt ${#ls[@]} && echo '-d') --color=always --human-readable --si --group-directories-first --file-type --dereference-command-line-symlink-to-dir --all $flags $(printf "'%s' " "${ls[@]:-.}")
fi
" || $elevate ls $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --dereference-command-line --all --sort=none $flags "${ls[@]:-.}"

View File

@ -9,9 +9,11 @@ case "$mime" in
--report-identical-files --label="$1" --label="$2" <(ff "$1") <(ff "$2")
;;
(*sqlite*) sqldiff "$@" ;;
(*) # Use wiked-diff only for text <10MB
if expr "$mime" : "text/" >/dev/null && test 10000000 -gt "$(stat --format=%s *.geojson | paste -s -d'+' | bc)"
(text/*)
# Use wiked-diff only for text <10MB
if test 10000000 -gt "$(stat --format=%s *.geojson | paste -s -d'+' | bc)"
then wiked-diff "$@"
else diff-color --report-identical-files "$@"
else diff --color=always --unified=1 --report-identical-files "$@"
fi;;
(*) diff-color --report-identical-files "$@";;
esac | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen

View File

@ -21,6 +21,7 @@ else repo="$1" && shift
cd "$(expr "$4" \| "$repo")"
fi
user="${1:-$repo}"
git remote remove upstream 2>/dev/null
git remote remove upstream 2>/dev/null || true
git remote add upstream "$(git-repo "${3:-github.com}" "$repo" "$user")"
git remote -v
exec $SHELL

View File

@ -1,7 +1,7 @@
#!/bin/sh -e
# Keeps the Internet at bay
if test -e "$JOURNAL"; then
echo "What do you want to do? Check your journal!"
echo "What do you want to do? Check your journal!" >&2
while test $(echo "$intention" | wc -c) -lt 10
do read intention
done

19
.local/bin/scripts/quickref Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
test-colors
cat <<'EOF'
Globbing:
- ${VAR#pattern} :: delete shortest match from beginning
: file='sdf/fd' && echo ${file#sdf/}
- ${VAR##pattern} :: delete longest match from beginning
- ${VAR%pattern} :: delete shortest match from end
- ${VAR%%pattern} :: delete longest match from end
- ${VAR/search/replace} :: Regex replacement (kinda?)
Examples:
- ${VAR:*} :: retain the part before the last colon
- ${VAR##*/} :: retain the basename
- ${VAR%.*} :: remove extension
- [[https://unix.stackexchange.com/a/486694][argument from end of list]] ::
: eval x=\$$(($#-1))
(uses arithmetic substitution, a non-POSIX feature)
EOF

View File

@ -1,3 +1,3 @@
#!/bin/sh
# Recursively add replaygain to the given files or from the current directory
r128gain -r --skip-tagged --preserve-times 1 "${@:-.}"
r128gain $(test -f "$1" || echo '--recursive') --skip-tagged --preserve-times 1 "${@:-.}"

View File

@ -1,5 +1,7 @@
#!/bin/sh
# TODO set brightness
pkill electron
pkill discord
pkill signal
pkill aw-server
pkill aw-qt

View File

@ -4,7 +4,7 @@
set -x
size=10
if test $# -eq 0
then args=$DATA/images/*.png
then args=$DATA/4-media/images/*.png
else echo "$1" | grep -v -e "\." -e "/" && size=$1 && shift
fi
cols="$(expr $(tput cols) / $size / 3 \| 1)"