bin: document scripts
This commit is contained in:
parent
beffa526ac
commit
afdb845fd1
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# [b]rowse - custom ls or bat depending on file type
|
||||||
# Show type & contents of given files or PWD
|
# Show type & contents of given files or PWD
|
||||||
|
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
#!/bin/sh
|
#!/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
|
cat "$@" | while read -r line; do echo -n "$line" | python -m json.tool 2>/dev/null; done | bat --language json --style numbers
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# interactive diff with pagination and nice coloring
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
# interactive diff with pagination
|
|
||||||
diff-color --report-identical-files "$@" |
|
diff-color --report-identical-files "$@" |
|
||||||
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
|
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/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") )
|
test ! -f "$1" && ( mkdir -p $(dirname "$1") || sudo mkdir -p $(dirname "$1") )
|
||||||
echo "Editing $1..."
|
echo "Editing $1..."
|
||||||
if test -w "$1" || (test ! -f "$1" && test -w $(dirname "$1"))
|
if test -w "$1" || (test ! -f "$1" && test -w $(dirname "$1"))
|
||||||
|
|
|
@ -17,7 +17,7 @@ for arg do
|
||||||
*.7z) 7z x "$arg" ;;
|
*.7z) 7z x "$arg" ;;
|
||||||
*.deb) ar x "$arg" ;;
|
*.deb) ar x "$arg" ;;
|
||||||
*.tar.xz) tar xf "$arg" ;;
|
*.tar.xz) tar xf "$arg" ;;
|
||||||
*.zst) unzstd "$arg" ;;
|
*.zst) unzstd "$arg" ;;
|
||||||
*) echo "'$arg' cannot be extracted by ex" ;;
|
*) echo "'$arg' cannot be extracted by ex" ;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Extract the icon of a given page using duckduckgo
|
||||||
read -p URL? url
|
read -p URL? url
|
||||||
xdg-open "https://icons.duckduckgo.com/ip2/$url.ico"
|
xdg-open "https://icons.duckduckgo.com/ip2/$url.ico"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# launch my focus playlist
|
||||||
playlistPath="$MUSIC/Playlists"
|
playlistPath="$MUSIC/Playlists"
|
||||||
test -z "$1" && vp "$playlistPath/focus.m3u8" ||
|
test -z "$1" && vp "$playlistPath/focus.m3u8" ||
|
||||||
(find -L $playlistPath -iname "focus-$1.m3u8" -print0 | grep --null-data . ||
|
(find -L $playlistPath -iname "focus-$1.m3u8" -print0 | grep --null-data . ||
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# Grep through all manuals
|
||||||
find /usr/share/man -name "*$1*" | xargs gunzip -c | grep $2 --color=auto
|
find /usr/share/man -name "*$1*" | xargs gunzip -c | grep $2 --color=auto
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# open info-page, man-page or buffered help flag
|
||||||
case $1 in
|
case $1 in
|
||||||
(vlc) unbuffer vlc --full-help "${@:2}" | ${PAGER:-less} --quit-if-one-screen;;
|
(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
|
(zsh|zmv) # https://unix.stackexchange.com/questions/19290/zmv-for-zsh-dry-runs-and-man-pages
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# Run a program in the background if it is not running already
|
||||||
#ps aux | grep -v $0 | grep -m 1 $1
|
#ps aux | grep -v $0 | grep -m 1 $1
|
||||||
echo -n "$1: "
|
echo -n "$1: "
|
||||||
pgrep ${2:-$1} -a | grep --color=never -m 1 . || ( echo Launching && ($1 >/dev/null 2>&1 &) )
|
pgrep ${2:-$1} -a | grep --color=never -m 1 . || ( echo Launching && ($1 >/dev/null 2>&1 &) )
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
local date_args=${LOG_TIME_DEFAULT:-d}
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
(y)
|
|
||||||
(m)
|
|
||||||
(d)
|
|
||||||
(h)
|
|
||||||
(t)
|
|
||||||
esac
|
|
|
@ -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)
|
k4=$(xrandr | grep -1 ' 3840' | grep ' connected ' | cut -d' ' -f1)
|
||||||
k2=$(xrandr | grep -1 ' 1920' | grep ' connected ' | cut -d' ' -f1)
|
k2=$(xrandr | grep -1 ' 1920' | grep ' connected ' | cut -d' ' -f1)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
#!/bin/sh
|
#!/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" "$@"
|
test "$EUID" -eq 0 || exec sudo "$0" "$@"
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
startx
|
|
||||||
# sudo /usr/bin/prime-switch
|
|
10
README.org
10
README.org
|
@ -2,6 +2,13 @@
|
||||||
I mainly use Arch Linux,
|
I mainly use Arch Linux,
|
||||||
currently with the KDE desktop environment
|
currently with the KDE desktop environment
|
||||||
with the intention to move to Awesome soon.
|
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
|
** Root
|
||||||
I am trying to keep my home clean,
|
I am trying to keep my home clean,
|
||||||
but some files unfortunately cannot be moved.
|
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~.
|
and configuration for ~less~ and ~fzf~.
|
||||||
** .config
|
** .config
|
||||||
- [[.config/shell][shell]] :: shell aliases & functions grouped into a few different areas, focused on zsh but mostly usable with bash
|
- [[.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
|
- ideavim, vifm, nvim :: vi-related tools
|
||||||
- git, yadm :: version control
|
- git, yadm :: version control
|
||||||
** .local
|
** .local
|
||||||
|
|
Loading…
Reference in New Issue