bin: various usability improvements
This commit is contained in:
parent
0ee45d5f6e
commit
69ddc06b67
|
@ -45,7 +45,7 @@ cd() {
|
||||||
# pr -4 -l1 -W $COLUMNS -S" "
|
# pr -4 -l1 -W $COLUMNS -S" "
|
||||||
command ls --sort=none --quote-name |
|
command ls --sort=none --quote-name |
|
||||||
head -12 |
|
head -12 |
|
||||||
xargs ls --sort=time --format=vertical --directory --literal --file-type --color=always --width $COLUMNS |
|
xargs ls --sort=time --format=vertical --directory --literal --classify --color=always --width $COLUMNS |
|
||||||
head -3
|
head -3
|
||||||
code=$? && test $code -eq 141 || return $code
|
code=$? && test $code -eq 141 || return $code
|
||||||
fi
|
fi
|
||||||
|
@ -53,7 +53,7 @@ cd() {
|
||||||
|
|
||||||
# LOCATE {{{1
|
# LOCATE {{{1
|
||||||
# TODO no double heading with bat
|
# TODO no double heading with bat
|
||||||
alias fselect='fzf -0 -1 --reverse --height=30% | while read f; do test -d "$f" && cd "$f" || { highlight "$f" && print -s "b \"$f\"" && b "$f"; }; done';
|
alias fselect='fzf -0 -1 --reverse --height=40% | while read f; do test -d "$f" && cd "$f" || { highlight "$f" && print -s "b \"$f\"" && b "$f"; }; done';
|
||||||
loci() {
|
loci() {
|
||||||
locate --all --ignore-case --basename --existing "$@" |
|
locate --all --ignore-case --basename --existing "$@" |
|
||||||
command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') |
|
command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') |
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#assume_yes = true
|
#assume_yes = true
|
||||||
|
|
||||||
# Disable specific steps - same options as the command line flag
|
# Disable specific steps - same options as the command line flag
|
||||||
disable = ["node", "nix", "emacs"] #, "pnpm", "config-update"]
|
disable = ["node", "nix", "emacs", "config_update"]
|
||||||
|
|
||||||
# Ignore failures for these steps
|
# Ignore failures for these steps
|
||||||
#ignore_failures = ["powershell"]
|
#ignore_failures = ["powershell"]
|
||||||
|
@ -17,7 +17,7 @@ no_retry = true
|
||||||
#run_in_tmux = true
|
#run_in_tmux = true
|
||||||
|
|
||||||
# List of remote machines with Topgrade installed on them
|
# List of remote machines with Topgrade installed on them
|
||||||
#remote_topgrades = ["tiger"]
|
remote_topgrades = ["tiger"]
|
||||||
|
|
||||||
# Arguments to pass SSH when upgrading remote systems
|
# Arguments to pass SSH when upgrading remote systems
|
||||||
#ssh_arguments = "-o ConnectTimeout=2"
|
#ssh_arguments = "-o ConnectTimeout=2"
|
||||||
|
@ -64,7 +64,7 @@ arguments = "--rebase --autostash"
|
||||||
|
|
||||||
[linux]
|
[linux]
|
||||||
# Arguments to pass yay when updating packages
|
# Arguments to pass yay when updating packages
|
||||||
yay_arguments = "--nodiffmenu --ignore android-studio --ignore clion --ignore intellij-idea-ultimate-edition --ignore intellij-idea-ultimate-edition-jre --ignore webstorm"
|
yay_arguments = "--nodiffmenu --ignore android-studio --ignore clion --ignore intellij-idea-ultimate-edition --ignore intellij-idea-ultimate-edition-jre --ignore webstorm --ignore brave-bin"
|
||||||
#trizen_arguments = "--devel"
|
#trizen_arguments = "--devel"
|
||||||
#enable_tlmgr = true
|
#enable_tlmgr = true
|
||||||
#emerge_sync_flags = "-q"
|
#emerge_sync_flags = "-q"
|
||||||
|
|
|
@ -183,7 +183,7 @@ if test "$ls" -o $# -le $(echo "$flags" | wc -w); then
|
||||||
{
|
{
|
||||||
timeout .6s sh -c "
|
timeout .6s sh -c "
|
||||||
if which exa 2>/dev/null >&2
|
if which exa 2>/dev/null >&2
|
||||||
then exa --color=always --long --group --classify --all --all --sort=changed --reverse $flags $(printf "'%s' " "${ls[@]:-.}")
|
then $elevate exa --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[@]:-.}")
|
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
|
fi
|
||||||
" || $elevate ls $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --dereference-command-line --all --sort=none $flags "${ls[@]:-.}"
|
" || $elevate ls $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --dereference-command-line --all --sort=none $flags "${ls[@]:-.}"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh -e
|
||||||
# Find config files with fzf, preview and edit them
|
# Find config files with fzf, preview and edit them
|
||||||
# Common config files are automatically checked/reloaded
|
# Common config files are automatically checked/reloaded
|
||||||
alias dedup='awk '"'"'!a[$0]++'"'"
|
alias dedup='awk '"'"'!a[$0]++'"'"
|
||||||
|
@ -32,6 +32,6 @@ case "$sel" in
|
||||||
(/etc/caddy/*) sudoedit "$sel" && caddy validate --config /etc/caddy/Caddyfile && sudo systemctl reload-or-restart caddy;;
|
(/etc/caddy/*) sudoedit "$sel" && caddy validate --config /etc/caddy/Caddyfile && sudo systemctl reload-or-restart caddy;;
|
||||||
(/etc/ssh/*) sudoedit "$sel" && sudo systemctl reload-or-restart sshd;;
|
(/etc/ssh/*) sudoedit "$sel" && sudo systemctl reload-or-restart sshd;;
|
||||||
(/etc/network/interfaces*) sudoedit "$sel" && sudo service networking reload;;
|
(/etc/network/interfaces*) sudoedit "$sel" && sudo service networking reload;;
|
||||||
(*) $(test -w "$sel" || echo sudo --preserve-env=ALTERNATE_EDITOR) $EDITOR "$sel";;
|
(*) $(test -w "$sel" || echo "sudo -E") edit "$sel";;
|
||||||
esac
|
esac
|
||||||
echo "$sel" | cat - "$conf_cache" | head -20 >"$conf_tmp" && mv "$conf_tmp" "$conf_cache"
|
echo "$sel" | cat - "$conf_cache" | head -20 >"$conf_tmp" && mv "$conf_tmp" "$conf_cache"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# adapted and improved from the commonly circulating version
|
# adapted and improved from the commonly circulating version
|
||||||
# detects whether unpacking into a subfolder is sensible
|
# detects whether unpacking into a subfolder is sensible
|
||||||
# and shows progress indications for some operations
|
# and shows progress indications for some operations
|
||||||
# optdepends: rewrite(part of my dotfiles)
|
# optdepends: rewrite(part of my dotfiles, for unzip line rewriting)
|
||||||
for arg do
|
for arg do
|
||||||
case $arg in
|
case $arg in
|
||||||
(-d) del=$(expr ${del:-0} + 1);;
|
(-d) del=$(expr ${del:-0} + 1);;
|
||||||
|
@ -14,6 +14,7 @@ case $arg in
|
||||||
name="$(basename "${fullpath%.*}")"
|
name="$(basename "${fullpath%.*}")"
|
||||||
namepart="$name.part"
|
namepart="$name.part"
|
||||||
(
|
(
|
||||||
|
# Create temporary subfolder if current folder contains stuff
|
||||||
if test "$(ls -U | wc -l)" -gt 2; then
|
if test "$(ls -U | wc -l)" -gt 2; then
|
||||||
mkdir -p "$namepart"
|
mkdir -p "$namepart"
|
||||||
cd "$namepart"
|
cd "$namepart"
|
||||||
|
@ -39,9 +40,9 @@ case $arg in
|
||||||
# If we created a temporary subfolder, check if it can be eliminated
|
# If we created a temporary subfolder, check if it can be eliminated
|
||||||
if test "$(basename "$PWD")" = "$namepart"
|
if test "$(basename "$PWD")" = "$namepart"
|
||||||
then if test $# -lt 2 -a "$(ls -U | wc -l)" -lt 3
|
then if test $# -lt 2 -a "$(ls -U | wc -l)" -lt 3
|
||||||
then test "$(ls)" && mv -v * ..
|
then test "$(ls)" && mv -iv * ..
|
||||||
cd .. && rm -d "$namepart"
|
cd .. && rm -d "$namepart"
|
||||||
else cd .. && mv -v "$namepart" "$name"
|
else cd .. && mv -iv "$namepart" "$name"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
case $del in
|
case $del in
|
||||||
|
|
|
@ -7,5 +7,5 @@ then cat
|
||||||
else printf '%s\n' "$@"
|
else printf '%s\n' "$@"
|
||||||
fi | while read f; do
|
fi | while read f; do
|
||||||
highlight "$f"
|
highlight "$f"
|
||||||
find "$f" -type f -exec ffprobe -loglevel warning -print_format default=noprint_wrappers=1 -show_format -pretty {} \;
|
find "$f" -type f -exec ffprobe -loglevel 20 -print_format default=noprint_wrappers=1 -show_format -pretty {} \;
|
||||||
done | less
|
done | less
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh -e
|
||||||
# Select a song in the mpd queue using fzf and mpc
|
# Select a song in the mpd queue using fzf and mpc
|
||||||
song_position=$(mpc -f "%position%) %artist% - %title%" playlist | \
|
# depends: fzy/fzf-tmux mpc
|
||||||
fzf-tmux --query="$1" --reverse --select-1 --exit-0 | \
|
song_position=$(mpc -f "%position%) %artist% - %title%" playlist |
|
||||||
sed -n 's/^\([0-9]\+\)).*/\1/p') || return 1
|
#fzy --query="$1" |
|
||||||
|
fzf-tmux --query="$1" --reverse --select-1 --exit-0 |
|
||||||
|
sed -n 's/^\([0-9]\+\)).*/\1/p')
|
||||||
test -n "$song_position" && mpc play $song_position
|
test -n "$song_position" && mpc play $song_position
|
||||||
|
|
|
@ -15,7 +15,7 @@ case $1 in
|
||||||
$0 "$diff"
|
$0 "$diff"
|
||||||
;;
|
;;
|
||||||
(*)
|
(*)
|
||||||
out="${2:-/tmp/freq-$(basename "$1").png}"
|
out="${2:-/tmp/freq-$(basename "$1")}.png"
|
||||||
mkdir -p "$(dirname "$out")"
|
mkdir -p "$(dirname "$out")"
|
||||||
sox "$1" -n spectrogram -o "$out"
|
sox "$1" -n spectrogram -o "$out"
|
||||||
timg --title "$out"
|
timg --title "$out"
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
# Use xdg-mime with a file's mime type
|
# Use xdg-mime with a file's mime type
|
||||||
xdg-mime query default "$(xdg-mime query filetype "$1")"
|
xdg-mime query default "$(xdg-mime query filetype "$1")"
|
||||||
test $# -gt 1 &&
|
if test $# -gt 1; then
|
||||||
desktop="$(find /usr/share/applications -name "*$2*" | fzf -0 -1)" &&
|
desktop="$(find /usr/share/applications -name "*$2*" | fzf -0 -1)" &&
|
||||||
xdg-mime default "$desktop" "$(xdg-mime query filetype "$1")" &&
|
xdg-mime default "$desktop" "$(xdg-mime query filetype "$1")" &&
|
||||||
echo -n "Updated to: " &&
|
echo -n "Updated to: " &&
|
||||||
xdg-mime query default "$(xdg-mime query filetype "$1")"
|
xdg-mime query default "$(xdg-mime query filetype "$1")"
|
||||||
|
fi
|
||||||
# || echo "Cannot find application $2 in /usr/share/applications!"
|
# || echo "Cannot find application $2 in /usr/share/applications!"
|
||||||
|
|
|
@ -67,7 +67,7 @@ makepkg -si
|
||||||
- video :: [[https://github.com/phw/peek][peek]] vlc obs-studio kdenlive
|
- video :: [[https://github.com/phw/peek][peek]] vlc obs-studio kdenlive
|
||||||
- music management :: puddletag beets picard ffmpegthumbnailer sox
|
- music management :: puddletag beets picard ffmpegthumbnailer sox
|
||||||
: sudo npm install -g bpm
|
: sudo npm install -g bpm
|
||||||
- music production :: lilypond lilypond-docs timidity++ chordpro-git musescore mixxx-beta-git
|
- music production :: lilypond lilypond-docs timidity++ chordpro-git musescore mixxx-beta-git soundfont-fluid
|
||||||
- communication :: zulip-desktop-bin ferdi-bin
|
- communication :: zulip-desktop-bin ferdi-bin
|
||||||
- hacking :: etcher-bin
|
- hacking :: etcher-bin
|
||||||
- health :: stretchly-xeruf-git redshift acpilight light
|
- health :: stretchly-xeruf-git redshift acpilight light
|
||||||
|
|
Loading…
Reference in New Issue