mirror of
https://github.com/notwa/rc
synced 2024-11-09 18:49:03 -08:00
convert compatibility lines to new format
This commit is contained in:
parent
74b2e5ef0a
commit
3a1ab5d5bc
89 changed files with 89 additions and 89 deletions
2
sh/argc
2
sh/argc
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
argc() { ### @- validate the number of arguments in a function.
|
argc() { ### @- validate the number of arguments in a function.
|
||||||
### ```sh
|
### ```sh
|
||||||
|
|
2
sh/arith
2
sh/arith
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# though technically compatible with other shells,
|
# though technically compatible with other shells,
|
||||||
# extra functionality is through zsh's extended arithmetic functions.
|
# extra functionality is through zsh's extended arithmetic functions.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env false
|
#!/usr/bin/env false
|
||||||
# YES_ZSH YES_BASH NO_DASH NO_ASH
|
# compat: -ash +bash -dash +zsh
|
||||||
|
|
||||||
whoa=(
|
whoa=(
|
||||||
-Wall
|
-Wall
|
||||||
|
|
2
sh/askey
2
sh/askey
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
askey() {
|
askey() {
|
||||||
printf '\033[100m 00 \033[m \033[100m 01 \033[m \033[100m 02 \033[m \033[100m 03 \033[m \033[100m 04 \033[m \033[100m 05 \033[m \033[100m 06 \033[m \033[100m 07 \033[m \033[100m 08 \033[m \033[100m 09 \033[m \033[100m 0A \033[m \033[100m 0B \033[m \033[100m 0C \033[m \033[100m 0D \033[m \033[100m 0E \033[m \033[100m 0F \033[m
|
printf '\033[100m 00 \033[m \033[100m 01 \033[m \033[100m 02 \033[m \033[100m 03 \033[m \033[100m 04 \033[m \033[100m 05 \033[m \033[100m 06 \033[m \033[100m 07 \033[m \033[100m 08 \033[m \033[100m 09 \033[m \033[100m 0A \033[m \033[100m 0B \033[m \033[100m 0C \033[m \033[100m 0D \033[m \033[100m 0E \033[m \033[100m 0F \033[m
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
# compat: -ash -bash -dash +zsh
|
||||||
|
|
||||||
# TODO: portable way of dodging aliases to allow other shell support?
|
# TODO: portable way of dodging aliases to allow other shell support?
|
||||||
|
|
||||||
|
|
2
sh/bak
2
sh/bak
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
bak() { ### @-
|
bak() { ### @-
|
||||||
### backup files by creating copies and appending ".bak" to their names.
|
### backup files by creating copies and appending ".bak" to their names.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
baknow() { ### @- backup files by appending their timestamps given by [`now`.](#now)
|
baknow() { ### @- backup files by appending their timestamps given by [`now`.](#now)
|
||||||
### ```
|
### ```
|
||||||
|
|
2
sh/baks
2
sh/baks
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# backup, timestamped
|
# backup, timestamped
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
baks() { ### @-
|
baks() { ### @-
|
||||||
### backup files by copying each and appending *the current* date-time,
|
### backup files by copying each and appending *the current* date-time,
|
||||||
|
|
2
sh/bin
2
sh/bin
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# though technically compatible with other shells,
|
# though technically compatible with other shells,
|
||||||
# extra functionality is through zsh's extended arithmetic functions.
|
# extra functionality is through zsh's extended arithmetic functions.
|
||||||
|
|
2
sh/burl
2
sh/burl
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
burl() ( ### @-
|
burl() ( ### @-
|
||||||
### turn bash into a makeshift HTTP client.
|
### turn bash into a makeshift HTTP client.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
# compat: -ash -bash -dash +zsh
|
||||||
|
|
||||||
busiest() { ### @-
|
busiest() { ### @-
|
||||||
### list directories in descending order by the number of files in them,
|
### list directories in descending order by the number of files in them,
|
||||||
|
|
2
sh/clash
2
sh/clash
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
clash() { ### @- run a command through 12 different shells.
|
clash() { ### @- run a command through 12 different shells.
|
||||||
### only returns false when no arguments are given.
|
### only returns false when no arguments are given.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# YES_ZSH YES_BASH NO_DASH NO_ASH
|
# compat: -ash +bash -dash +zsh
|
||||||
|
|
||||||
colors() { ### @-
|
colors() { ### @-
|
||||||
### display all combinations of foreground and background terminal colors.
|
### display all combinations of foreground and background terminal colors.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
colors2() {
|
colors2() {
|
||||||
[ $# -eq 0 ] || { printf "%s\n" "$0: does not take arguments" >&2; return 1; }
|
[ $# -eq 0 ] || { printf "%s\n" "$0: does not take arguments" >&2; return 1; }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
# compat: -ash -bash -dash +zsh
|
||||||
|
|
||||||
setup_clang_ubuntu() { ### @-
|
setup_clang_ubuntu() { ### @-
|
||||||
### print (but don't execute) the commands necessary to install
|
### print (but don't execute) the commands necessary to install
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
### @ confirm
|
### @ confirm
|
||||||
### display a simple yes-or-no prompt and return 0-or-1 respectively.
|
### display a simple yes-or-no prompt and return 0-or-1 respectively.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK YES_OT_AWK
|
# compat: +ash +bash +dash +zsh YES_BB_AWK YES_OT_AWK
|
||||||
|
|
||||||
countdiff() { ### @-
|
countdiff() { ### @-
|
||||||
### count the number of lines changed between two files.
|
### count the number of lines changed between two files.
|
||||||
|
|
2
sh/cutv
2
sh/cutv
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
# compat: -ash -bash -dash +zsh
|
||||||
|
|
||||||
cutv() {
|
cutv() {
|
||||||
argc $# -ge 2 "$0" || return
|
argc $# -ge 2 "$0" || return
|
||||||
|
|
2
sh/dated
2
sh/dated
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
dated() {
|
dated() {
|
||||||
local ts= u=0
|
local ts= u=0
|
||||||
|
|
2
sh/days
2
sh/days
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
days() { ### @-
|
days() { ### @-
|
||||||
### compute the number of days since a given date.
|
### compute the number of days since a given date.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# TODO: check if this is compatible with busybox.
|
# TODO: check if this is compatible with busybox.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
dedupe() ( ### @- copy a directory, but make hard/softlinks for identical files.
|
dedupe() ( ### @- copy a directory, but make hard/softlinks for identical files.
|
||||||
# Copyright (C) 2022 Connor Olding
|
# Copyright (C) 2022 Connor Olding
|
||||||
|
|
2
sh/dfu
2
sh/dfu
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK YES_OT_AWK
|
# compat: +ash +bash +dash +zsh YES_BB_AWK YES_OT_AWK
|
||||||
|
|
||||||
dfu() { ### @-
|
dfu() { ### @-
|
||||||
### pretty-print `df` in GiB.
|
### pretty-print `df` in GiB.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
disowned() { ### @- find files in system directories that aren't associated with any pacman packages.
|
disowned() { ### @- find files in system directories that aren't associated with any pacman packages.
|
||||||
#
|
#
|
||||||
|
|
2
sh/e
2
sh/e
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||||
|
|
||||||
e() { ### @-
|
e() { ### @-
|
||||||
### wrap around `$EDITOR` to run it as root if necessary.
|
### wrap around `$EDITOR` to run it as root if necessary.
|
||||||
|
|
2
sh/ea
2
sh/ea
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# remote file access (http file-sharing shenanigans)
|
# remote file access (http file-sharing shenanigans)
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
__ea_curl() {
|
__ea_curl() {
|
||||||
curl -q --no-progress-meter 127.255.255.255 >/dev/null 2>&1
|
curl -q --no-progress-meter 127.255.255.255 >/dev/null 2>&1
|
||||||
|
|
2
sh/echo2
2
sh/echo2
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
echo2() { ### @-
|
echo2() { ### @-
|
||||||
### print arguments joined by spaces to stderr without parsing anything.
|
### print arguments joined by spaces to stderr without parsing anything.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
explore() { ### @- open a single directory in `explorer.exe`, defaulting to `$PWD`.
|
explore() { ### @- open a single directory in `explorer.exe`, defaulting to `$PWD`.
|
||||||
[ -n "$MSYSTEM" ] || { printf "%s\n" "$0: only for MSYS2" >&2; return 1; }
|
[ -n "$MSYSTEM" ] || { printf "%s\n" "$0: only for MSYS2" >&2; return 1; }
|
||||||
|
|
2
sh/feud
2
sh/feud
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
### @feud - parse command-line arguments, mapping short-flags to variable names.
|
### @feud - parse command-line arguments, mapping short-flags to variable names.
|
||||||
### **NOTE:** the API is still experimental and will undergo major changes.
|
### **NOTE:** the API is still experimental and will undergo major changes.
|
||||||
|
|
2
sh/ff
2
sh/ff
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
ff() { ### @-
|
ff() { ### @-
|
||||||
### select a file from a given or current directory using
|
### select a file from a given or current directory using
|
||||||
|
|
2
sh/ghmd
2
sh/ghmd
|
@ -2,7 +2,7 @@
|
||||||
# ghmd - format GitHub markdown
|
# ghmd - format GitHub markdown
|
||||||
# via: https://leahneukirchen.org/dotfiles/.zshrc
|
# via: https://leahneukirchen.org/dotfiles/.zshrc
|
||||||
# example: ghmd < README.md > README.html
|
# example: ghmd < README.md > README.html
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
ghmd() { ### @-
|
ghmd() { ### @-
|
||||||
### convert a markdown file to HTML in the style of GitHub.
|
### convert a markdown file to HTML in the style of GitHub.
|
||||||
|
|
2
sh/glug
2
sh/glug
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env dash
|
#!/usr/bin/env dash
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
# fuck termcap, all my homies hate termcap.
|
# fuck termcap, all my homies hate termcap.
|
||||||
|
|
||||||
glug() ( # note the subshell syntax. this allows us to abuse globals like crazy.
|
glug() ( # note the subshell syntax. this allows us to abuse globals like crazy.
|
||||||
|
|
2
sh/grab
2
sh/grab
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
__grab() { ### @grab - download a file from my site and verify its integrity by its [minisign](https://github.com/jedisct1/minisign/) signature.
|
__grab() { ### @grab - download a file from my site and verify its integrity by its [minisign](https://github.com/jedisct1/minisign/) signature.
|
||||||
[ -z "${ZSH_VERSION}" ] || emulate sh
|
[ -z "${ZSH_VERSION}" ] || emulate sh
|
||||||
|
|
2
sh/grop
2
sh/grop
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# TODO: check for existence of grep -P; write a perl-based fallback.
|
# TODO: check for existence of grep -P; write a perl-based fallback.
|
||||||
grop() { ### @- invoke grep with `-oP`.
|
grop() { ### @- invoke grep with `-oP`.
|
||||||
|
|
2
sh/grop4
2
sh/grop4
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
grop4() { ### @- [`grop`](#grop) for IPv4s.
|
grop4() { ### @- [`grop`](#grop) for IPv4s.
|
||||||
grep -oP -- '(?<=^|[^\d.])((0|1\d\d|2[0-4]\d|25[0-5]|[1-9]\d?)\.((?2))\.((?2))\.((?2)))(?=$|[^\d.])'
|
grep -oP -- '(?<=^|[^\d.])((0|1\d\d|2[0-4]\d|25[0-5]|[1-9]\d?)\.((?2))\.((?2))\.((?2)))(?=$|[^\d.])'
|
||||||
|
|
2
sh/has
2
sh/has
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
has() { ### @- [`have`,](#have) silently.
|
has() { ### @- [`have`,](#have) silently.
|
||||||
if [ -z "$ZSH_VERSION" ]; then which -- "$1"; else whence -p -- "$1"; fi
|
if [ -z "$ZSH_VERSION" ]; then which -- "$1"; else whence -p -- "$1"; fi
|
||||||
|
|
2
sh/have
2
sh/have
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
have() { ### @- print the result of `which` if the program is found, else simply return 1.
|
have() { ### @- print the result of `which` if the program is found, else simply return 1.
|
||||||
### ```
|
### ```
|
||||||
|
|
2
sh/hex
2
sh/hex
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# though technically compatible with other shells,
|
# though technically compatible with other shells,
|
||||||
# extra functionality is through zsh's extended arithmetic functions.
|
# extra functionality is through zsh's extended arithmetic functions.
|
||||||
|
|
2
sh/ify
2
sh/ify
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/sh
|
#!/usr/bin/sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
ify() { ### @-
|
ify() { ### @-
|
||||||
### pipe one command through another, so you can still pass arguments to the former.
|
### pipe one command through another, so you can still pass arguments to the former.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# YES_ZSH YES_BASH NO_DASH NO_ASH
|
# compat: -ash +bash -dash +zsh
|
||||||
|
|
||||||
is_empty() { ### @-
|
is_empty() { ### @-
|
||||||
### return 0 if the directory given by argument is empty.
|
### return 0 if the directory given by argument is empty.
|
||||||
|
|
2
sh/isup
2
sh/isup
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
isup() { ### @-
|
isup() { ### @-
|
||||||
### return 0 if a given website returns a 2xx HTTP code.
|
### return 0 if a given website returns a 2xx HTTP code.
|
||||||
|
|
2
sh/join2
2
sh/join2
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
join2() { ### @- join every other line.
|
join2() { ### @- join every other line.
|
||||||
# TODO: argc, also better interface that allows n file inputs without stdin.
|
# TODO: argc, also better interface that allows n file inputs without stdin.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
# compat: -ash -bash -dash +zsh
|
||||||
|
|
||||||
lsarchive() { ### @- list the contents of an archive file in one of many formats.
|
lsarchive() { ### @- list the contents of an archive file in one of many formats.
|
||||||
### borrowed from [prezto.](https://github.com/sorin-ionescu/prezto)
|
### borrowed from [prezto.](https://github.com/sorin-ionescu/prezto)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
__maybesudo() { ### @maybesudo
|
__maybesudo() { ### @maybesudo
|
||||||
### mimic certain features of `sudo` for systems without it installed.
|
### mimic certain features of `sudo` for systems without it installed.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env dash
|
#!/usr/bin/env dash
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
minutemaid() { ### @-
|
minutemaid() { ### @-
|
||||||
### check if the current minute is divisible by a given number,
|
### check if the current minute is divisible by a given number,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
# compat: -ash -bash -dash +zsh
|
||||||
|
|
||||||
monitor() { ### @-
|
monitor() { ### @-
|
||||||
### this is [watch(1)](https://www.man7.org/linux/man-pages/man1/watch.1.html)
|
### this is [watch(1)](https://www.man7.org/linux/man-pages/man1/watch.1.html)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# YES_ZSH YES_BASH NO_DASH NO_ASH
|
# compat: -ash +bash -dash +zsh
|
||||||
|
|
||||||
morecolors() { ### @- print all 256 colors that are available on most terminals.
|
morecolors() { ### @- print all 256 colors that are available on most terminals.
|
||||||
# borrowed from leah2's dotfiles.
|
# borrowed from leah2's dotfiles.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# TODO: what's the minimum version of perl required for this?
|
# TODO: what's the minimum version of perl required for this?
|
||||||
|
|
||||||
|
|
2
sh/note
2
sh/note
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
note() { ### @-
|
note() { ### @-
|
||||||
### act like [`echo2`,](#echo2) but use a bright color to stand out more.
|
### act like [`echo2`,](#echo2) but use a bright color to stand out more.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
__notice_warn() {
|
__notice_warn() {
|
||||||
printf >&2 'notice: %s\n' "$*"
|
printf >&2 'notice: %s\n' "$*"
|
||||||
|
|
2
sh/now
2
sh/now
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
now() { ### @-
|
now() { ### @-
|
||||||
### print a date-time (UTC) in a sortable format.
|
### print a date-time (UTC) in a sortable format.
|
||||||
|
|
2
sh/oshi
2
sh/oshi
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
__oshi() { ### @oshi
|
__oshi() { ### @oshi
|
||||||
### upload files (or stdin) to [oshi.at.](https://oshi.at)
|
### upload files (or stdin) to [oshi.at.](https://oshi.at)
|
||||||
|
|
2
sh/oxo
2
sh/oxo
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# **TL;DR RULES:**
|
# **TL;DR RULES:**
|
||||||
# * no executables (for the most part)
|
# * no executables (for the most part)
|
||||||
|
|
2
sh/pacbm
2
sh/pacbm
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# TODO: does this work with busybox awk?
|
# TODO: does this work with busybox awk?
|
||||||
|
|
||||||
|
|
2
sh/pause
2
sh/pause
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
### @ pause
|
### @ pause
|
||||||
### pause — the companion script of [`confirm`.](#confirm)
|
### pause — the companion script of [`confirm`.](#confirm)
|
||||||
|
|
2
sh/pegg
2
sh/pegg
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
pegg() { ### @-
|
pegg() { ### @-
|
||||||
### download and (pip) install a Python "egg" from a project on GitHub,
|
### download and (pip) install a Python "egg" from a project on GitHub,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
__permit_hex() {
|
__permit_hex() {
|
||||||
if xxd -l 0 2>/dev/null; then
|
if xxd -l 0 2>/dev/null; then
|
||||||
|
|
2
sh/pippy
2
sh/pippy
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
pippy() { ### @-
|
pippy() { ### @-
|
||||||
### install Python packages using pip,
|
### install Python packages using pip,
|
||||||
|
|
2
sh/pre
2
sh/pre
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
pre() { ### @-
|
pre() { ### @-
|
||||||
### dump all the `#define`s that `$CC $CPPFLAGS $CFLAGS $LDFLAGS` would result in.
|
### dump all the `#define`s that `$CC $CPPFLAGS $CFLAGS $LDFLAGS` would result in.
|
||||||
|
|
2
sh/psbm
2
sh/psbm
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||||
|
|
||||||
psbm() { ### @-
|
psbm() { ### @-
|
||||||
### display and order processes by their memory usage ascending, and their sum.
|
### display and order processes by their memory usage ascending, and their sum.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# works with busybox.
|
# works with busybox.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
__recolor_install() {
|
__recolor_install() {
|
||||||
ForegroundColour() { recolor RAW 10 "$@"; }
|
ForegroundColour() { recolor RAW 10 "$@"; }
|
||||||
|
|
2
sh/rot13
2
sh/rot13
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# works with busybox tr.
|
# works with busybox tr.
|
||||||
|
|
||||||
|
|
2
sh/rs
2
sh/rs
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
# compat: -ash -bash -dash +zsh
|
||||||
|
|
||||||
rs() { ### @-
|
rs() { ### @-
|
||||||
### record screen. does not record audio.
|
### record screen. does not record audio.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||||
|
|
||||||
# probably not compatible with busybox ps because its column 2 isn't PID.
|
# probably not compatible with busybox ps because its column 2 isn't PID.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
### @ scount
|
### @ scount
|
||||||
### perform `sort | uniq -c | sort -n`, preferring GNU awk when available.
|
### perform `sort | uniq -c | sort -n`, preferring GNU awk when available.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# does not work with busybox sed (yet?)
|
# does not work with busybox sed (yet?)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
scropt() { ### @-
|
scropt() { ### @-
|
||||||
### run `scrot` through `optipng` and save the result to `~/play/$(now).png`.
|
### run `scrot` through `optipng` and save the result to `~/play/$(now).png`.
|
||||||
|
|
2
sh/shcom
2
sh/shcom
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
shcom() { ### @-
|
shcom() { ### @-
|
||||||
### comment out text from stdin and wrap it in a markdown blockquote
|
### comment out text from stdin and wrap it in a markdown blockquote
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||||
|
|
||||||
similar() { ### @-
|
similar() { ### @-
|
||||||
### highlight adjacent lines up to the first inequivalent character.
|
### highlight adjacent lines up to the first inequivalent character.
|
||||||
|
|
2
sh/slit
2
sh/slit
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env dash
|
#!/usr/bin/env dash
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# works with busybox ash.
|
# works with busybox ash.
|
||||||
|
|
||||||
|
|
2
sh/slitt
2
sh/slitt
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env dash
|
#!/usr/bin/env dash
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
# works with busybox ash.
|
# works with busybox ash.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/sh
|
#!/usr/bin/sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
sortip() { ### @- sort lines numerically by IPv4 segments.
|
sortip() { ### @- sort lines numerically by IPv4 segments.
|
||||||
sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n "$@"
|
sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n "$@"
|
||||||
|
|
2
sh/sram
2
sh/sram
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH YES_BASH NO_DASH NO_ASH
|
# compat: -ash +bash -dash +zsh
|
||||||
|
|
||||||
sram() { ### @-
|
sram() { ### @-
|
||||||
### convert between a couple saveram formats for N64 emulators.
|
### convert between a couple saveram formats for N64 emulators.
|
||||||
|
|
2
sh/stfu
2
sh/stfu
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
stfu() { ### @-
|
stfu() { ### @-
|
||||||
### invoke a command, silencing stdout and stderr *unless* the command fails.
|
### invoke a command, silencing stdout and stderr *unless* the command fails.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env false
|
#!/usr/bin/env false
|
||||||
# awful things
|
# awful things
|
||||||
# YES_ZSH YES_BASH NO_DASH NO_ASH
|
# compat: -ash +bash -dash +zsh
|
||||||
|
|
||||||
mpvs() {
|
mpvs() {
|
||||||
mpv --quiet \
|
mpv --quiet \
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
__subdue() { ### @subdue
|
__subdue() { ### @subdue
|
||||||
### reconfigure your terminal's color scheme using a preset for [recolor.](#recolor)
|
### reconfigure your terminal's color scheme using a preset for [recolor.](#recolor)
|
||||||
|
|
2
sh/sum
2
sh/sum
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
sum() { ### @-
|
sum() { ### @-
|
||||||
### compute the summation of its arguments without forking processes.
|
### compute the summation of its arguments without forking processes.
|
||||||
|
|
2
sh/sv
2
sh/sv
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||||
|
|
||||||
sv() { ### @-
|
sv() { ### @-
|
||||||
### collect the lastmost value of every key.
|
### collect the lastmost value of every key.
|
||||||
|
|
2
sh/trash
2
sh/trash
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
trash() { ### @-
|
trash() { ### @-
|
||||||
### output a given number of bytes from `/dev/random`.
|
### output a given number of bytes from `/dev/random`.
|
||||||
|
|
2
sh/trunc
2
sh/trunc
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||||
|
|
||||||
trunc() { ### @-
|
trunc() { ### @-
|
||||||
### truncate text to fit within your terminal using the unicode character `…`.
|
### truncate text to fit within your terminal using the unicode character `…`.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
# compat: -ash -bash -dash +zsh
|
||||||
|
|
||||||
unarchive() { ### @- extract the contents of an archive file in one of many formats.
|
unarchive() { ### @- extract the contents of an archive file in one of many formats.
|
||||||
### borrowed from [prezto.](https://github.com/sorin-ionescu/prezto)
|
### borrowed from [prezto.](https://github.com/sorin-ionescu/prezto)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
unwrap() { ### @- join paragraphs into one line each.
|
unwrap() { ### @- join paragraphs into one line each.
|
||||||
awk '\''BEGIN{RS="\n\n";FS="\n"}{for(i=1;i<=NF;i++)printf "%s ",$i;print "\n"}'\'
|
awk '\''BEGIN{RS="\n\n";FS="\n"}{for(i=1;i<=NF;i++)printf "%s ",$i;print "\n"}'\'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
v_domap() {
|
v_domap() {
|
||||||
argc $# -eq 1 "$0" || return
|
argc $# -eq 1 "$0" || return
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
v_lower() { ### @- transform the contents of a variable to lowercase.
|
v_lower() { ### @- transform the contents of a variable to lowercase.
|
||||||
argc $# -eq 1 "$0" || return
|
argc $# -eq 1 "$0" || return
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
v_upper() { ### @- transform the contents of a variable to uppercase.
|
v_upper() { ### @- transform the contents of a variable to uppercase.
|
||||||
argc $# -eq 1 "$0" || return
|
argc $# -eq 1 "$0" || return
|
||||||
|
|
2
sh/wat
2
sh/wat
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
# compat: -ash -bash -dash +zsh
|
||||||
|
|
||||||
# wat - a better and recursive which/whence
|
# wat - a better and recursive which/whence
|
||||||
# via: https://leahneukirchen.org/dotfiles/tools.html
|
# via: https://leahneukirchen.org/dotfiles/tools.html
|
||||||
|
|
2
sh/wipe
2
sh/wipe
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||||
|
|
||||||
wipe() { ### @-
|
wipe() { ### @-
|
||||||
### clear the screen and its scrollback, then print a high-contrast horizontal line.
|
### clear the screen and its scrollback, then print a high-contrast horizontal line.
|
||||||
|
|
2
sh/xxp
2
sh/xxp
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
# compat: +ash +bash +dash +zsh
|
||||||
|
|
||||||
xxp() { ### @-
|
xxp() { ### @-
|
||||||
### act like `xxd -p`, but nicely formatted.
|
### act like `xxd -p`, but nicely formatted.
|
||||||
|
|
Loading…
Reference in a new issue