bin: script adjustments on debian
This commit is contained in:
parent
256df9cf71
commit
e86bd6e2b6
|
@ -186,7 +186,7 @@ alias jcj='jce -o json-pretty --unit' # JSON View
|
||||||
# Shorthands
|
# Shorthands
|
||||||
alias v='edit'
|
alias v='edit'
|
||||||
alias st='synct'
|
alias st='synct'
|
||||||
alias ex='dtrx'
|
which dtrx >/dev/null && alias ex='dtrx'
|
||||||
alias expr='noglob expr'
|
alias expr='noglob expr'
|
||||||
alias get='noglob ='
|
alias get='noglob ='
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# [b]rowse - overview of given files or current directory
|
# [b]rowse - overview of given files or current directory
|
||||||
# depends: tput stat bat checkaccess(in my dotfiles)
|
# depends: tput stat bat checkaccess(in my dotfiles)
|
||||||
# optdepends: timg, neovim (compressed files), pdftoppm (PDF), mtn (video), audiowaveform
|
# optdepends: timg, neovim (compressed files), pdftoppm (PDF), mtn (video), audiowaveform, imagemagick (images)
|
||||||
# args: files to inspect, any arg starting with dash is passed on to bat
|
# args: files to inspect, any arg starting with dash is passed on to bat
|
||||||
#
|
#
|
||||||
# Supports:
|
# Supports:
|
||||||
|
@ -75,13 +75,11 @@ for arg; do
|
||||||
# https://ask.libreoffice.org/t/convert-to-command-line-parameter/840/4
|
# https://ask.libreoffice.org/t/convert-to-command-line-parameter/840/4
|
||||||
echo Converting "$arg"
|
echo Converting "$arg"
|
||||||
soffice --headless --convert-to png --outdir "$prefix" "$arg" >/dev/null
|
soffice --headless --convert-to png --outdir "$prefix" "$arg" >/dev/null
|
||||||
timg+=("${tmpfile%.*}.png")
|
timg+=("${tmpfile%.*}.png");;
|
||||||
continue;;
|
|
||||||
(*/x-xcf*)
|
(*/x-xcf*)
|
||||||
echo Converting "$arg"
|
echo Converting "$arg"
|
||||||
convert -flatten "$arg" png:"$tmpfile"
|
convert -flatten "$arg" png:"$tmpfile"
|
||||||
timg+=("$tmpfile")
|
timg+=("$tmpfile");;
|
||||||
continue;;
|
|
||||||
(*\ video/*)
|
(*\ video/*)
|
||||||
suffix=_thumbs.jpg
|
suffix=_thumbs.jpg
|
||||||
mtn -i -t -W -r2 -D6 -b 0,6 -c $grid -w $(expr $(tput cols) '*' 20) \
|
mtn -i -t -W -r2 -D6 -b 0,6 -c $grid -w $(expr $(tput cols) '*' 20) \
|
||||||
|
@ -89,7 +87,8 @@ for arg; do
|
||||||
timg -W "$prefix/$(basename "${arg%.*}")$suffix"
|
timg -W "$prefix/$(basename "${arg%.*}")$suffix"
|
||||||
;;
|
;;
|
||||||
(*\ image/*)
|
(*\ image/*)
|
||||||
timg+=("$arg"); continue;;
|
timg+=("$arg")
|
||||||
|
which identify && continue;;
|
||||||
(*\ inode/directory\;*)
|
(*\ inode/directory\;*)
|
||||||
ls+=("$arg")
|
ls+=("$arg")
|
||||||
test -L "$arg" || continue
|
test -L "$arg" || continue
|
||||||
|
@ -140,7 +139,7 @@ if test "$timg"; then
|
||||||
$(test $# -gt 1 &&
|
$(test $# -gt 1 &&
|
||||||
echo "-t0.2 --center $(test $# -lt 20 && echo "--title") --grid=$((grid < $# ? grid : $#))x2") \
|
echo "-t0.2 --center $(test $# -lt 20 && echo "--title") --grid=$((grid < $# ? grid : $#))x2") \
|
||||||
"${timg[@]}" "${timga[@]}" 2>/dev/null || true
|
"${timg[@]}" "${timga[@]}" 2>/dev/null || true
|
||||||
if $inspect || test $# -lt 10; then
|
if which identify && ( $inspect || test $# -lt 10 ); then
|
||||||
tput setaf 6
|
tput setaf 6
|
||||||
for img in "${timg[@]}"
|
for img in "${timg[@]}"
|
||||||
do ident="$(identify -ping -precision 3 -format "%wx%h %b %m %[bit-depth]-bit %[colorspace]" "$img")"
|
do ident="$(identify -ping -precision 3 -format "%wx%h %b %m %[bit-depth]-bit %[colorspace]" "$img")"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# [c]at the given files as prettified [j]son
|
# [c]at the given files as prettified [j]son
|
||||||
cat "$@" | while read -r line; do echo -n "$line" | python3 -m json.tool; done | bat --language json --style numbers
|
|
||||||
|
# add echo in case file is missing newline at the end
|
||||||
|
{ cat "$@"; echo; } | while read -r line; do echo -n "$line" | python3 -m json.tool; done | bat --language json --style numbers
|
||||||
|
|
|
@ -27,7 +27,9 @@ case $arg in
|
||||||
(*.7z|*.z01|*.zip|*.jar)
|
(*.7z|*.z01|*.zip|*.jar)
|
||||||
if which 7z >/dev/null
|
if which 7z >/dev/null
|
||||||
then 7z x $param "$fullpath"
|
then 7z x $param "$fullpath"
|
||||||
else unzip "$fullpath" | rewrite
|
else which p7zip >/dev/null &&
|
||||||
|
p7zip --decompress $param "$fullpath" ||
|
||||||
|
unzip "$fullpath" | rewrite
|
||||||
fi;;
|
fi;;
|
||||||
(*.gz) gunzip "$fullpath" ;;
|
(*.gz) gunzip "$fullpath" ;;
|
||||||
(*.bz2) bunzip2 "$fullpath" ;;
|
(*.bz2) bunzip2 "$fullpath" ;;
|
||||||
|
|
|
@ -14,8 +14,8 @@ do
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$elevate find "$f" -maxdepth $(expr 1 \& "$f" = "/" \| 5 \& $# \> 0 \| 4) -type d -empty -name .stfolder -exec rm -div {} \;
|
$elevate find -H "$f" -maxdepth $(expr 1 \& "$f" = "/" \| 5 \& $# \> 0 \| 4) -type d -empty -name .stfolder -exec rm -div {} \;
|
||||||
$elevate find "$f" -maxdepth $(expr 1 \& "$f" = "/" \| 5 \& $# \> 0 \| 3) -not -name .stfolder \( -type d -o -type f \) -a -empty -printf 'Removing empty %p\n' -delete
|
$elevate find -H "$f" -maxdepth $(expr 1 \& "$f" = "/" \| 5 \& $# \> 0 \| 3) -not -name .stfolder \( -type d -o -type f \) -a -empty -printf 'Removing empty %p\n' -delete
|
||||||
test $# -eq 0 && exit $?
|
test $# -eq 0 && exit $?
|
||||||
if test -e "$f"; then
|
if test -e "$f"; then
|
||||||
echo -n "$f ($(ls -A "$f" | head -3 | paste -s -d' ')) " >&2 &&
|
echo -n "$f ($(ls -A "$f" | head -3 | paste -s -d' ')) " >&2 &&
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
# Use grep and sed to replace $1 with $2 recursively and print what is done
|
# Use grep and sed to replace $1 with $2 recursively and print what is done
|
||||||
grep --null --recursive --files-with-matches \
|
grep --null --recursive --files-with-matches \
|
||||||
--binary-files=without-match $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "$1" "${@:3}" |
|
--binary-files=without-match $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "${@:3}" -- "$1" |
|
||||||
xargs -0 sed -i "\%${1}%{
|
xargs -0 sed -i "\%${1}%{
|
||||||
s||${2}|g
|
s||${2}|g
|
||||||
w /dev/stdout
|
w /dev/stdout
|
||||||
|
|
3
.zshenv
3
.zshenv
|
@ -34,6 +34,7 @@ export GOPATH="$XDG_STATE_HOME"/go
|
||||||
export CARGO_HOME="$XDG_DATA_HOME"/cargo
|
export CARGO_HOME="$XDG_DATA_HOME"/cargo
|
||||||
export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
|
export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
|
||||||
export NVM_DIR="$XDG_DATA_HOME"/nvm
|
export NVM_DIR="$XDG_DATA_HOME"/nvm
|
||||||
|
export KREW_ROOT="$XDG_DATA_HOME"/krew
|
||||||
|
|
||||||
export CABAL_CONFIG="$XDG_CONFIG_HOME"/cabal/config
|
export CABAL_CONFIG="$XDG_CONFIG_HOME"/cabal/config
|
||||||
export CABAL_DIR="$XDG_CACHE_HOME"/cabal
|
export CABAL_DIR="$XDG_CACHE_HOME"/cabal
|
||||||
|
@ -65,7 +66,7 @@ mkdir -p "$XDG_STATE_HOME/zsh"
|
||||||
|
|
||||||
# environment
|
# environment
|
||||||
BIN="$HOME/.local/bin"
|
BIN="$HOME/.local/bin"
|
||||||
export PATH="$BIN/scripts:$BIN:$PATH:$XDG_CONFIG_HOME/emacs/bin:$GOPATH/bin:$XDG_DATA_HOME/gem/ruby/3.0.0/bin:$ANDROID_SDK_ROOT/platform-tools:$CARGO_HOME/bin"
|
export PATH="$BIN/scripts:$BIN:$PATH:$XDG_CONFIG_HOME/emacs/bin:$GOPATH/bin:$XDG_DATA_HOME/gem/ruby/3.0.0/bin:$ANDROID_SDK_ROOT/platform-tools:$CARGO_HOME/bin:$KREW_ROOT/bin"
|
||||||
export ALTERNATE_EDITOR="$(
|
export ALTERNATE_EDITOR="$(
|
||||||
if which nvim >/dev/null
|
if which nvim >/dev/null
|
||||||
then echo nvim
|
then echo nvim
|
||||||
|
|
Loading…
Reference in New Issue