mirror of
https://github.com/notwa/rc
synced 2024-12-21 21:49:40 -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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
argc() { ### @- validate the number of arguments in a function.
|
||||
### ```sh
|
||||
|
|
2
sh/arith
2
sh/arith
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
# though technically compatible with other shells,
|
||||
# extra functionality is through zsh's extended arithmetic functions.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env false
|
||||
# YES_ZSH YES_BASH NO_DASH NO_ASH
|
||||
# compat: -ash +bash -dash +zsh
|
||||
|
||||
whoa=(
|
||||
-Wall
|
||||
|
|
2
sh/askey
2
sh/askey
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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?
|
||||
|
||||
|
|
2
sh/bak
2
sh/bak
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
bak() { ### @-
|
||||
### backup files by creating copies and appending ".bak" to their names.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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)
|
||||
### ```
|
||||
|
|
2
sh/baks
2
sh/baks
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
# backup, timestamped
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
baks() { ### @-
|
||||
### 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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
# though technically compatible with other shells,
|
||||
# extra functionality is through zsh's extended arithmetic functions.
|
||||
|
|
2
sh/burl
2
sh/burl
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
burl() ( ### @-
|
||||
### turn bash into a makeshift HTTP client.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
||||
# compat: -ash -bash -dash +zsh
|
||||
|
||||
busiest() { ### @-
|
||||
### 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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
clash() { ### @- run a command through 12 different shells.
|
||||
### only returns false when no arguments are given.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# YES_ZSH YES_BASH NO_DASH NO_ASH
|
||||
# compat: -ash +bash -dash +zsh
|
||||
|
||||
colors() { ### @-
|
||||
### display all combinations of foreground and background terminal colors.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
colors2() {
|
||||
[ $# -eq 0 ] || { printf "%s\n" "$0: does not take arguments" >&2; return 1; }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
||||
# compat: -ash -bash -dash +zsh
|
||||
|
||||
setup_clang_ubuntu() { ### @-
|
||||
### print (but don't execute) the commands necessary to install
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
### @ confirm
|
||||
### display a simple yes-or-no prompt and return 0-or-1 respectively.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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() { ### @-
|
||||
### count the number of lines changed between two files.
|
||||
|
|
2
sh/cutv
2
sh/cutv
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
||||
# compat: -ash -bash -dash +zsh
|
||||
|
||||
cutv() {
|
||||
argc $# -ge 2 "$0" || return
|
||||
|
|
2
sh/dated
2
sh/dated
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
dated() {
|
||||
local ts= u=0
|
||||
|
|
2
sh/days
2
sh/days
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
days() { ### @-
|
||||
### compute the number of days since a given date.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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.
|
||||
# Copyright (C) 2022 Connor Olding
|
||||
|
|
2
sh/dfu
2
sh/dfu
|
@ -1,5 +1,5 @@
|
|||
#!/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() { ### @-
|
||||
### pretty-print `df` in GiB.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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.
|
||||
#
|
||||
|
|
2
sh/e
2
sh/e
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
||||
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||
|
||||
e() { ### @-
|
||||
### wrap around `$EDITOR` to run it as root if necessary.
|
||||
|
|
2
sh/ea
2
sh/ea
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
# remote file access (http file-sharing shenanigans)
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
__ea_curl() {
|
||||
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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
echo2() { ### @-
|
||||
### print arguments joined by spaces to stderr without parsing anything.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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`.
|
||||
[ -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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
### @feud - parse command-line arguments, mapping short-flags to variable names.
|
||||
### **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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
ff() { ### @-
|
||||
### select a file from a given or current directory using
|
||||
|
|
2
sh/ghmd
2
sh/ghmd
|
@ -2,7 +2,7 @@
|
|||
# ghmd - format GitHub markdown
|
||||
# via: https://leahneukirchen.org/dotfiles/.zshrc
|
||||
# example: ghmd < README.md > README.html
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
ghmd() { ### @-
|
||||
### 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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
# fuck termcap, all my homies hate termcap.
|
||||
|
||||
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
|
||||
# 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.
|
||||
[ -z "${ZSH_VERSION}" ] || emulate sh
|
||||
|
|
2
sh/grop
2
sh/grop
|
@ -1,5 +1,5 @@
|
|||
#!/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.
|
||||
grop() { ### @- invoke grep with `-oP`.
|
||||
|
|
2
sh/grop4
2
sh/grop4
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
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.])'
|
||||
|
|
2
sh/has
2
sh/has
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
has() { ### @- [`have`,](#have) silently.
|
||||
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
|
||||
# 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.
|
||||
### ```
|
||||
|
|
2
sh/hex
2
sh/hex
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
# though technically compatible with other shells,
|
||||
# extra functionality is through zsh's extended arithmetic functions.
|
||||
|
|
2
sh/ify
2
sh/ify
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
ify() { ### @-
|
||||
### pipe one command through another, so you can still pass arguments to the former.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# YES_ZSH YES_BASH NO_DASH NO_ASH
|
||||
# compat: -ash +bash -dash +zsh
|
||||
|
||||
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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
isup() { ### @-
|
||||
### 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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
join2() { ### @- join every other line.
|
||||
# TODO: argc, also better interface that allows n file inputs without stdin.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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.
|
||||
### borrowed from [prezto.](https://github.com/sorin-ionescu/prezto)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
__maybesudo() { ### @maybesudo
|
||||
### mimic certain features of `sudo` for systems without it installed.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env dash
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
minutemaid() { ### @-
|
||||
### check if the current minute is divisible by a given number,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
||||
# compat: -ash -bash -dash +zsh
|
||||
|
||||
monitor() { ### @-
|
||||
### this is [watch(1)](https://www.man7.org/linux/man-pages/man1/watch.1.html)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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.
|
||||
# borrowed from leah2's dotfiles.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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?
|
||||
|
||||
|
|
2
sh/note
2
sh/note
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
note() { ### @-
|
||||
### act like [`echo2`,](#echo2) but use a bright color to stand out more.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
__notice_warn() {
|
||||
printf >&2 'notice: %s\n' "$*"
|
||||
|
|
2
sh/now
2
sh/now
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
now() { ### @-
|
||||
### print a date-time (UTC) in a sortable format.
|
||||
|
|
2
sh/oshi
2
sh/oshi
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
__oshi() { ### @oshi
|
||||
### upload files (or stdin) to [oshi.at.](https://oshi.at)
|
||||
|
|
2
sh/oxo
2
sh/oxo
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
# **TL;DR RULES:**
|
||||
# * no executables (for the most part)
|
||||
|
|
2
sh/pacbm
2
sh/pacbm
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
# TODO: does this work with busybox awk?
|
||||
|
||||
|
|
2
sh/pause
2
sh/pause
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
### @ pause
|
||||
### pause — the companion script of [`confirm`.](#confirm)
|
||||
|
|
2
sh/pegg
2
sh/pegg
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
pegg() { ### @-
|
||||
### download and (pip) install a Python "egg" from a project on GitHub,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
__permit_hex() {
|
||||
if xxd -l 0 2>/dev/null; then
|
||||
|
|
2
sh/pippy
2
sh/pippy
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
pippy() { ### @-
|
||||
### install Python packages using pip,
|
||||
|
|
2
sh/pre
2
sh/pre
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
pre() { ### @-
|
||||
### 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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
||||
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||
|
||||
psbm() { ### @-
|
||||
### display and order processes by their memory usage ascending, and their sum.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
# works with busybox.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
__recolor_install() {
|
||||
ForegroundColour() { recolor RAW 10 "$@"; }
|
||||
|
|
2
sh/rot13
2
sh/rot13
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
# works with busybox tr.
|
||||
|
||||
|
|
2
sh/rs
2
sh/rs
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
||||
# compat: -ash -bash -dash +zsh
|
||||
|
||||
rs() { ### @-
|
||||
### record screen. does not record audio.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
### @ scount
|
||||
### perform `sort | uniq -c | sort -n`, preferring GNU awk when available.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
# does not work with busybox sed (yet?)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
scropt() { ### @-
|
||||
### 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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
shcom() { ### @-
|
||||
### comment out text from stdin and wrap it in a markdown blockquote
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
||||
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||
|
||||
similar() { ### @-
|
||||
### highlight adjacent lines up to the first inequivalent character.
|
||||
|
|
2
sh/slit
2
sh/slit
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env dash
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
# works with busybox ash.
|
||||
|
||||
|
|
2
sh/slitt
2
sh/slitt
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env dash
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
# works with busybox ash.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
sortip() { ### @- sort lines numerically by IPv4 segments.
|
||||
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
|
||||
# YES_ZSH YES_BASH NO_DASH NO_ASH
|
||||
# compat: -ash +bash -dash +zsh
|
||||
|
||||
sram() { ### @-
|
||||
### convert between a couple saveram formats for N64 emulators.
|
||||
|
|
2
sh/stfu
2
sh/stfu
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
stfu() { ### @-
|
||||
### invoke a command, silencing stdout and stderr *unless* the command fails.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env false
|
||||
# awful things
|
||||
# YES_ZSH YES_BASH NO_DASH NO_ASH
|
||||
# compat: -ash +bash -dash +zsh
|
||||
|
||||
mpvs() {
|
||||
mpv --quiet \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
__subdue() { ### @subdue
|
||||
### 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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
sum() { ### @-
|
||||
### compute the summation of its arguments without forking processes.
|
||||
|
|
2
sh/sv
2
sh/sv
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
||||
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||
|
||||
sv() { ### @-
|
||||
### collect the lastmost value of every key.
|
||||
|
|
2
sh/trash
2
sh/trash
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
trash() { ### @-
|
||||
### output a given number of bytes from `/dev/random`.
|
||||
|
|
2
sh/trunc
2
sh/trunc
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
||||
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||
|
||||
trunc() { ### @-
|
||||
### truncate text to fit within your terminal using the unicode character `…`.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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.
|
||||
### borrowed from [prezto.](https://github.com/sorin-ionescu/prezto)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
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"}'\'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
v_domap() {
|
||||
argc $# -eq 1 "$0" || return
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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.
|
||||
argc $# -eq 1 "$0" || return
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/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.
|
||||
argc $# -eq 1 "$0" || return
|
||||
|
|
2
sh/wat
2
sh/wat
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
# YES_ZSH NO_BASH NO_DASH NO_ASH
|
||||
# compat: -ash -bash -dash +zsh
|
||||
|
||||
# wat - a better and recursive which/whence
|
||||
# via: https://leahneukirchen.org/dotfiles/tools.html
|
||||
|
|
2
sh/wipe
2
sh/wipe
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH YES_BB_AWK
|
||||
# compat: +ash +bash +dash +zsh YES_BB_AWK
|
||||
|
||||
wipe() { ### @-
|
||||
### 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
|
||||
# YES_ZSH YES_BASH YES_DASH YES_ASH
|
||||
# compat: +ash +bash +dash +zsh
|
||||
|
||||
xxp() { ### @-
|
||||
### act like `xxd -p`, but nicely formatted.
|
||||
|
|
Loading…
Reference in a new issue