bin: document scripts

This commit is contained in:
xeruf 2021-07-29 16:02:20 +02:00
parent beffa526ac
commit afdb845fd1
15 changed files with 24 additions and 16 deletions

View File

@ -1,4 +1,5 @@
#!/bin/sh
# [b]rowse - custom ls or bat depending on file type
# Show type & contents of given files or PWD
set -eo pipefail

View File

@ -1,2 +1,3 @@
#!/bin/sh
# [c]at the given files as prettified [j]son
cat "$@" | while read -r line; do echo -n "$line" | python -m json.tool 2>/dev/null; done | bat --language json --style numbers

View File

@ -1,5 +1,5 @@
#!/bin/sh
# interactive diff with pagination and nice coloring
set -o pipefail
# interactive diff with pagination
diff-color --report-identical-files "$@" |
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen

View File

@ -1,5 +1,5 @@
#!/bin/sh
# Edit a file with appropriate rights, creating parent directories if necessary
test ! -f "$1" && ( mkdir -p $(dirname "$1") || sudo mkdir -p $(dirname "$1") )
echo "Editing $1..."
if test -w "$1" || (test ! -f "$1" && test -w $(dirname "$1"))

View File

@ -17,7 +17,7 @@ for arg do
*.7z) 7z x "$arg" ;;
*.deb) ar x "$arg" ;;
*.tar.xz) tar xf "$arg" ;;
*.zst) unzstd "$arg" ;;
*.zst) unzstd "$arg" ;;
*) echo "'$arg' cannot be extracted by ex" ;;
esac
else

View File

@ -1,3 +1,4 @@
#!/bin/bash
# Extract the icon of a given page using duckduckgo
read -p URL? url
xdg-open "https://icons.duckduckgo.com/ip2/$url.ico"

View File

@ -1,3 +1,4 @@
# launch my focus playlist
playlistPath="$MUSIC/Playlists"
test -z "$1" && vp "$playlistPath/focus.m3u8" ||
(find -L $playlistPath -iname "focus-$1.m3u8" -print0 | grep --null-data . ||

View File

@ -1,2 +1,3 @@
#!/bin/sh
# Grep through all manuals
find /usr/share/man -name "*$1*" | xargs gunzip -c | grep $2 --color=auto

View File

@ -1,4 +1,5 @@
#!/bin/sh
# open info-page, man-page or buffered help flag
case $1 in
(vlc) unbuffer vlc --full-help "${@:2}" | ${PAGER:-less} --quit-if-one-screen;;
(zsh|zmv) # https://unix.stackexchange.com/questions/19290/zmv-for-zsh-dry-runs-and-man-pages

View File

@ -1,4 +1,5 @@
#!/bin/sh
# Run a program in the background if it is not running already
#ps aux | grep -v $0 | grep -m 1 $1
echo -n "$1: "
pgrep ${2:-$1} -a | grep --color=never -m 1 . || ( echo Launching && ($1 >/dev/null 2>&1 &) )

View File

@ -1,10 +0,0 @@
#!/bin/sh
local date_args=${LOG_TIME_DEFAULT:-d}
case $1 in
(y)
(m)
(d)
(h)
(t)
esac

View File

@ -1,3 +1,4 @@
# Reconfigure two side-by-side 4k and FHD displays via xrandr
k4=$(xrandr | grep -1 ' 3840' | grep ' connected ' | cut -d' ' -f1)
k2=$(xrandr | grep -1 ' 1920' | grep ' connected ' | cut -d' ' -f1)

View File

@ -1,4 +1,8 @@
#!/bin/sh
# Blocks internet at night using iptables and enables it only upon request
# Migration to nftables is outstanding
# Auto-elevate
test "$EUID" -eq 0 || exec sudo "$0" "$@"
set -e

View File

@ -1,2 +0,0 @@
startx
# sudo /usr/bin/prime-switch

View File

@ -2,6 +2,13 @@
I mainly use Arch Linux,
currently with the KDE desktop environment
with the intention to move to Awesome soon.
If you are looking to snag some of my handy tools,
focus on =.local/bin/scripts= and =.config/shell=.
Among daily use are ~b~, ~edbin~, ~edconf~, ~edit~, ~yas~, ~walli~
and [[https://github.com/ajeetdsouza/zoxide][zoxide]]-based ~d~/~di~ which in turn use ~zfz~, ~zf~ & ~locz~.
~ex~, ~help~, ~moul~, ~mvk~, ~rpl~, ~s~, ~sd~, ~tl~ are also commonly used conveniences.
** Root
I am trying to keep my home clean,
but some files unfortunately cannot be moved.
@ -10,7 +17,8 @@ it contains lots of mappings to store files according to XDG
and configuration for ~less~ and ~fzf~.
** .config
- [[.config/shell][shell]] :: shell aliases & functions grouped into a few different areas, focused on zsh but mostly usable with bash
- doom :: [[https://github.com/hlissner/doom-emacs][Doom Emacs]] configuration with personalized snippets
- [[.config/zsh][zsh]] :: zsh plugin configuration & custom completions
- [[.config/doom][doom]] :: [[https://github.com/hlissner/doom-emacs][Doom Emacs]] configuration with personalized snippets
- ideavim, vifm, nvim :: vi-related tools
- git, yadm :: version control
** .local