1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-05-19 02:03:22 -07:00

Compare commits

..

No commits in common. "a9f8dd642cfe5117e64f02748ee84d682f267035" and "13149ff607c0ad00da8047a53360c0298bf1382c" have entirely different histories.

16 changed files with 86 additions and 270 deletions

142
README.md
View File

@ -190,7 +190,7 @@ defaults to clang, gcc, and msvc in that order.
# debug build
compile rd.c
compile debug rd.c
# debug build with warning/error flags defined in ~/sh/arrays
# debug build with warning/error flags defined in .-shrc
# (requires .zshrc for global alias expansion)
compile WHOA rd.c
# likewise for C++
@ -284,7 +284,7 @@ Filesystem Used Max Left Misc
find files in system directories that aren't associated with any pacman packages.
### [document](/sh/document#L146)
### [document](/sh/document#L150)
generate a markdown file out of docstrings in shell scripts.
@ -799,14 +799,6 @@ extract the contents of an archive file in one of many formats.
borrowed from [prezto.](https://github.com/sorin-ionescu/prezto)
### [v_lower](/sh/v_lower#L7)
transform the contents of a variable to lowercase.
### [v_upper](/sh/v_upper#L7)
transform the contents of a variable to uppercase.
### [wat](/sh/wat#L9)
wat — a better and recursive which/whence. for zsh only.
@ -838,272 +830,272 @@ $ xxp ~/rc/install | head -n2
## miscellaneous
### [dummy (zshrc)](/home/zshrc#L76)
### [dummy (zshrc)](/home/zshrc#L69)
return 0, ignoring arguments.
### [dirprev (zshrc)](/home/zshrc#L81)
### [dirprev (zshrc)](/home/zshrc#L74)
rotate and change to the previous directory in the directory stack
without consuming the prompt.
### [dirnext (zshrc)](/home/zshrc#L88)
### [dirnext (zshrc)](/home/zshrc#L81)
rotate and change to the next directory in the directory stack
without consuming the prompt.
### [dirup (zshrc)](/home/zshrc#L95)
### [dirup (zshrc)](/home/zshrc#L88)
change to the parent directory of the current working directory
without consuming the prompt.
### [dirview (zshrc)](/home/zshrc#L102)
### [dirview (zshrc)](/home/zshrc#L95)
use a fuzzy finder to select a recent directory in the directory stack
and change to it without consuming the prompt.
### [OMFG (zshrc)](/home/zshrc#L200)
### [OMFG (zshrc)](/home/zshrc#L193)
silence stdout.
### [STFU (zshrc)](/home/zshrc#L201)
### [STFU (zshrc)](/home/zshrc#L194)
silence stderr.
### [WHOA (zshrc)](/home/zshrc#L202)
### [WHOA (zshrc)](/home/zshrc#L195)
expand to several C/C++ flags to ease development.
### [WELP (zshrc)](/home/zshrc#L203)
### [WELP (zshrc)](/home/zshrc#L196)
expand to C++ flags to enable a C++-as-C facade.
### [tw (zshrc)](/home/zshrc#L208)
### [tw (zshrc)](/home/zshrc#L201)
invoke `twitch` as a job with both stdout and stderr silenced.
### [reload (zshrc)](/home/zshrc#L252)
### [reload (zshrc)](/home/zshrc#L245)
reload zsh by wiping temp files, recompiling rc files,
and replacing the current process with a new zsh process.
### [dummy (bashrc)](/home/bashrc#L46)
### [dummy (bashrc)](/home/bashrc#L45)
return 0, ignoring arguments.
### [reload (bashrc)](/home/bashrc#L51)
### [reload (bashrc)](/home/bashrc#L50)
**TODO:** respect initctl like in `.zshrc`.
### [ADDPATH (shrc)](/home/shrc#L24)
### [ADDPATH (-shrc)](/home/-shrc#L20)
append a directory to `$PATH` if it isn't already present.
### [fils (shrc)](/home/shrc#L85)
### [fils (-shrc)](/home/-shrc#L81)
(GNU du) display human-friendly filesizes for the files in a directory.
### [lsa (shrc)](/home/shrc#L86)
### [lsa (-shrc)](/home/-shrc#L82)
(GNU ls) list files with directories and dotfiles ordered first.
### [perlu (shrc)](/home/shrc#L87)
### [perlu (-shrc)](/home/-shrc#L83)
invoke perl expecting files with UTF-8 encoding.
### [rgn (shrc)](/home/shrc#L88)
### [rgn (-shrc)](/home/-shrc#L84)
invoke ripgrep without respecting `.gitignore` files.
### [cms (shrc)](/home/shrc#L89)
### [cms (-shrc)](/home/-shrc#L85)
invoke cryptominisat5 with less noise.
### [curls (shrc)](/home/shrc#L90)
### [curls (-shrc)](/home/-shrc#L86)
invoke curl with less noise.
### [get (shrc)](/home/shrc#L95)
### [get (-shrc)](/home/-shrc#L91)
retrieve the most recent files from the default branch of a git repository, and not much else.
### [gs (shrc)](/home/shrc#L96)
### [gs (-shrc)](/home/-shrc#L92)
invoke git's status subcommand.
**TODO:** consider renaming because gs(1) already exists.
### [gd (shrc)](/home/shrc#L98)
### [gd (-shrc)](/home/-shrc#L94)
invoke git's diff subcommand with fewer lines of context.
### [gds (shrc)](/home/shrc#L99)
### [gds (-shrc)](/home/-shrc#L95)
display difference stats from git.
### [gl (shrc)](/home/shrc#L100)
### [gl (-shrc)](/home/-shrc#L96)
invoke git's log subcommand with a single line per commit.
**TODO:** consider renaming because [gl(1)](https://github.com/gitless-vcs/gitless) already exists.
### [glo (shrc)](/home/shrc#L102)
### [glo (-shrc)](/home/-shrc#L98)
navigate git's commit tree succinctly.
### [g1 (shrc)](/home/shrc#L103)
### [g1 (-shrc)](/home/-shrc#L99)
display the most recent git commit.
### [gr (shrc)](/home/shrc#L105)
### [gr (-shrc)](/home/-shrc#L100)
display remote git repositories verbosely.
### [gb (shrc)](/home/shrc#L106)
### [gb (-shrc)](/home/-shrc#L101)
display the current git branch.
**NOTE:** there also exists a gb(1) program provided by
the *gb* package that i don't use.
### [gdp (shrc)](/home/shrc#L109)
### [gdp (-shrc)](/home/-shrc#L104)
invoke `gd` to diff a commit from its parent. the commit defaults to "HEAD".
### [revend (shrc)](/home/shrc#L120)
### [revend (-shrc)](/home/-shrc#L114)
reverse the 4-byte endianness of a single file. *this is an in-place operation!*
### [clone (shrc)](/home/shrc#L121)
### [clone (-shrc)](/home/-shrc#L115)
invoke rsync suitably for creating virtually indistinguishable copies of files.
### [aligntabs (shrc)](/home/shrc#L122)
### [aligntabs (-shrc)](/home/-shrc#L116)
align tab-delimited fields in stdin.
### [crawla (shrc)](/home/shrc#L123)
### [crawla (-shrc)](/home/-shrc#L117)
play Dungeon Crawl: Stone Soup through ssh on the akrasiac server.
### [crawlz (shrc)](/home/shrc#L124)
### [crawlz (-shrc)](/home/-shrc#L118)
play Dungeon Crawl: Stone Soup through ssh on the develz server.
### [eahead (shrc)](/home/shrc#L126)
### [eahead (-shrc)](/home/-shrc#L120)
deprecated name for [`ea head`.](#ea)
### [eaget (shrc)](/home/shrc#L127)
### [eaget (-shrc)](/home/-shrc#L121)
deprecated name for [`ea get`.](#ea)
### [eaput (shrc)](/home/shrc#L128)
### [eaput (-shrc)](/home/-shrc#L122)
deprecated name for [`ea put`.](#ea)
### [eamove (shrc)](/home/shrc#L129)
### [eamove (-shrc)](/home/-shrc#L123)
deprecated name for [`ea move`.](#ea)
### [eacopy (shrc)](/home/shrc#L130)
### [eacopy (-shrc)](/home/-shrc#L124)
deprecated name for [`ea copy`.](#ea)
### [eadelete (shrc)](/home/shrc#L131)
### [eadelete (-shrc)](/home/-shrc#L125)
deprecated name for [`ea delete`.](#ea)
### [eamv (shrc)](/home/shrc#L132)
### [eamv (-shrc)](/home/-shrc#L126)
invoke [`ea move`.](#ea)
### [eacp (shrc)](/home/shrc#L133)
### [eacp (-shrc)](/home/-shrc#L127)
invoke [`ea copy`.](#ea)
### [earm (shrc)](/home/shrc#L134)
### [earm (-shrc)](/home/-shrc#L128)
invoke [`ea delete`.](#ea)
### [ll (shrc)](/home/shrc#L136)
### [ll (-shrc)](/home/-shrc#L130)
list files verbosely, fancily, ordered, but not recursively.
### [diff (shrc)](/home/shrc#L145)
### [diff (-shrc)](/home/-shrc#L139)
use git's diff subcommand for general diffing.
### [gc (shrc)](/home/shrc#L146)
### [gc (-shrc)](/home/-shrc#L140)
columnize text by using git's column subcommand.
**TODO:** consider renaming because gc(1) already exists.
### [counts (shrc)](/home/shrc#L148)
### [counts (-shrc)](/home/-shrc#L142)
count files in the current directory, including files found recursively.
### [exts (shrc)](/home/shrc#L149)
### [exts (-shrc)](/home/-shrc#L143)
count and sort file extensions in the current directory, including files found recursively.
### [nocom (shrc)](/home/shrc#L150)
### [nocom (-shrc)](/home/-shrc#L144)
strip single-line C-like and shell-like comments.
### [jrep (shrc)](/home/shrc#L151)
### [jrep (-shrc)](/home/-shrc#L145)
extract strings comprised of basic ASCII or Japanese codepoints.
### [bomb (shrc)](/home/shrc#L152)
### [bomb (-shrc)](/home/-shrc#L146)
add a Byte-Order Mark to a file.
### [cleanse (shrc)](/home/shrc#L153)
### [cleanse (-shrc)](/home/-shrc#L147)
strip unprintable and non-ASCII characters.
### [unwrap (shrc)](/home/shrc#L154)
### [unwrap (-shrc)](/home/-shrc#L148)
join paragraphs into one line each.
### [double (shrc)](/home/shrc#L155)
### [double (-shrc)](/home/-shrc#L149)
print every line twice. <br/> print every line twice.
**NOTE:** there also exists a double(1) program provided by
the *plotutils* package that i don't use.
### [join2 (shrc)](/home/shrc#L158)
### [join2 (-shrc)](/home/-shrc#L152)
join every other line.
### [katagana (shrc)](/home/shrc#L159)
### [katagana (-shrc)](/home/-shrc#L153)
convert katakana codepoints to their equivalent hiragana.
this is occasionally useful when translating [debug text from ancient games.](https://tcrf.net/)
### [picky (shrc)](/home/shrc#L161)
### [picky (-shrc)](/home/-shrc#L155)
list pacman packages that were manually installed and are not in some common package groups.
this list can be used to assist later reinstalls.
### [unused (shrc)](/home/shrc#L164)
### [unused (-shrc)](/home/-shrc#L158)
list pacman packages that weren't installed explicitly and don't satisfy any dependencies.
this list can be used to free up some disk space.
### [makepkgf (shrc)](/home/shrc#L167)
### [makepkgf (-shrc)](/home/-shrc#L161)
make the freakin' package!
### [rakef (shrc)](/home/shrc#L168)
### [rakef (-shrc)](/home/-shrc#L162)
make the freakin' gem!
### [pl (shrc)](/home/shrc#L170)
### [pl (-shrc)](/home/-shrc#L164)
print each argument on its own line.
@ -1123,7 +1115,6 @@ print each argument on its own line.
| [bin](#bin) | zsh | ✔️ | ✔️ | ✔️ | ✔️ |
| [busiest](#busiest) | zsh | ✔️ | ⭕ | ⭕ | ⭕ |
| [colors](#colors) | bash | ✔️ | ✔️ | ⭕ | ⭕ |
| [colors2](#colors2) | bash | ✔️ | ✔️ | ✔️ | ✔️ |
| [compile](#compile) | zsh | ✔️ | ⭕ | ⭕ | ⭕ |
| [confirm](#confirm) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [countdiff](#countdiff) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
@ -1133,7 +1124,7 @@ print each argument on its own line.
| [decently](#decently) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [dfu](#dfu) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [disowned](#disowned) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [document](#document) | dash | ✔️ | ✔️ | ✔️ | ✔️ |
| [document](#document) | dash | ⭕ | ⭕ | ✔️ | ✔️ |
| [e](#e) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [ea](#ea) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [echo2](#echo2) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
@ -1184,9 +1175,6 @@ print each argument on its own line.
| [trash](#trash) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [trunc](#trunc) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [unarchive](#unarchive) | zsh | ✔️ | ⭕ | ⭕ | ⭕ |
| [v_domap](#v_domap) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [v_lower](#v_lower) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [v_upper](#v_upper) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [wat](#wat) | zsh | ✔️ | ⭕ | ⭕ | ⭕ |
| [wipe](#wipe) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
| [xxp](#xxp) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |

View File

@ -1,10 +1,6 @@
#!/usr/bin/env false
# for ash, dash, bash, and zsh.
[ -n "$ZSH_VERSION" -o -n "$BASH_VERSION" ] && FANCY=1 || FANCY=0
if [ "$FANCY" = 0 ]; then
. ~/.prep # handle boring stuff like /etc/profile and $PATH
fi
# {{{1 utilities
@ -53,7 +49,7 @@ export EA_AUTH="auth"
export EA_DIR="t"
export EA_DOMAIN="https://eaguru.guru"
export EDITOR=vim
export ENV="$HOME/.shrc" # for dash and ash
export ENV="$HOME/.-shrc" # for dash
export PAGER=less
export PYTHONIOENCODING=utf-8 # damnit python!
export SSH_AUTH_SOCK=0 # more info: https://0x0.st/NUnw
@ -70,7 +66,7 @@ fi
# enable colors {{{2
if [ "$FANCY" = 1 ]; then
if [ "$FANCY" -eq 1 ]; then
# busybox is smart enough to ignore --color flags when unsupported.
alias grep='grep --color=auto'
alias ls='ls --color=auto'
@ -101,7 +97,6 @@ alias gl='git log --oneline' ### @- invoke git's log subcommand with a single li
### **TODO:** consider renaming because [gl(1)](https://github.com/gitless-vcs/gitless) already exists.
alias glo='git log --graph --decorate --pretty=oneline --abbrev-commit --all' ### @- navigate git's commit tree succinctly.
alias g1='git log --pretty=oneline --abbrev-commit --color=always | head -1' ### @- display the most recent git commit.
alias g11='git rev-parse --short HEAD'
alias gr='git remote -v' ### @- display remote git repositories verbosely.
alias gb='git --no-pager branch' ### @- display the current git branch.
### **NOTE:** there also exists a gb(1) program provided by
@ -115,7 +110,6 @@ gdp() { ### @- invoke `gd` to diff a commit from its parent. the commit defaults
# being specific {{{2
alias ash="PS1='$ ' busybox ash"
alias cort='LC_ALL=C sort'
alias pip="maybesudo -H pip3"
alias revend='objcopy -I binary -O binary --reverse-bytes=4' ### @- reverse the 4-byte endianness of a single file. *this is an in-place operation!*
alias clone='maybesudo rsync -aHA --info=progress2 --no-i-r' ### @- invoke rsync suitably for creating virtually indistinguishable copies of files.

View File

@ -1,5 +1,4 @@
[ -z "$PS1" ] && return
. ~/.prep # handle boring stuff like /etc/profile and $PATH
HISTCONTROL=erasedups
HISTSIZE=1000
@ -29,7 +28,7 @@ ret_fail="$_title${Cfail}$_line1\n${Cfail}$_line2"
PROMPT_COMMAND='[ $? = 0 ] && PS1=${ret_succ} || PS1=${ret_fail}'
. ~/.shrc
. ~/.-shrc
# this doesn't work for all scripts at the moment, but
ADDPATH "$HOME/sh"

View File

@ -1,52 +0,0 @@
#!/usr/bin/env false
# for ash, dash, bash, and zsh.
if [ -r /etc/msystem ]; then
# avoid sourcing /etc/profile because forking cygwin processes is awful.
. /etc/msystem # this doesn't fork anything, thankfully.
# NOTE: never inherits parent process's PATH. does not add perl paths.
PATH="/usr/local/bin:/usr/bin:/bin"
PATH="$PATH:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem"
PATH="$PATH:/c/Windows/System32/WindowsPowerShell/v1.0/"
MANPATH="/usr/local/man:/usr/share/man:/usr/man:/share/man"
INFOPATH="/usr/local/info:/usr/share/info:/usr/info:/share/info"
SYSCONFDIR="${SYSCONFDIR:-/etc}" # not exported for some reason?
CONFIG_SITE="/etc/config.site"
SHELL="/usr/bin/zsh"
if [ "$MSYSTEM" = MSYS ]; then
PATH="$PATH:/opt/bin"
PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig"
else
PATH="$MINGW_PREFIX/bin:$PATH"
PKG_CONFIG_PATH="$MINGW_PREFIX/lib/pkgconfig:$MINGW_PREFIX/share/pkgconfig"
export ACLOCAL_PATH="$MINGW_PREFIX/share/aclocal:/usr/share/aclocal"
MANPATH="$MINGW_PREFIX/local/man:$MINGW_PREFIX/share/man:$MANPATH"
fi
[ -n "${USER:=$USERNAME}" ] || USER="$(exec id -un)" # not much choice here
[ -n "${HOSTNAME:=$HOST}" ] || HOSTNAME="$(exec /usr/bin/hostname)"
LANG="en_US.UTF-8"
[ -s /etc/localtime ] && TZ=":/etc/localtime" || TZ="America/Vancouver"
TMP="/tmp"; TEMP="/tmp"
tmp="C:\\Users\\$USER\\AppData\\Local\\Temp"; temp="$tmp"
ORIGINAL_TMP="/c/Users/$USER/AppData/Local/Temp"; ORIGINAL_TEMP="$ORIGINAL_TMP"
export CONFIG_SITE HOSTNAME INFOPATH LANG MANPATH ORIGINAL_TEMP ORIGINAL_TMP PATH PKG_CONFIG_PATH SHELL TEMP TMP TZ USER temp tmp
elif [ -r /etc/profile ]; then
if [ -n "$ZSH_VERSION" ]; then
emulate sh -c "source /etc/profile"
else
. /etc/profile
fi
else # something's strange; set some sane defaults (from alpine)
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export CHARSET="UTF-8"
export LANG="C.UTF-8"
export LC_COLLATE="C"
fi

View File

@ -26,9 +26,6 @@ set -g set-titles-string '#{host}: #{pane_title}'
setw -g window-status-format "#I:#{s/.*\\\\|\.exe//:pane_current_command}"
setw -g window-status-current-format "#I:#{s/.*\\\\|\.exe//:pane_current_command}"
# don't wrap around with searches
setw -g wrap-search off
# set the default terminal to tmux instead of pretending to be screen.
# NOTE: netbsd-curses requires a terminfo.cdb to be built with tmux support.
# for my own convenience:

View File

@ -122,20 +122,6 @@ let $PATH .= ':'.$HOME.'/sh' " allow direct invocation of shell funcs
" fun {{{1
fu! Colour(name) " go nuts. go wild.
hi clear | syntax clear | syntax on " reset everything for sure (#4405)
if has('termguicolors')
if &term =~ "^tmux-256color"
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
endif
exe "colo " . a:name
endf
command! -nargs=* Colour call Colour(<f-args>)
" lifted from BurntSushi:
fu! GlobalReplace()
normal! gv"ry

View File

@ -1,4 +1,4 @@
. ~/.prep # handle boring stuff like /etc/profile and $PATH
[ -e /etc/profile ] && emulate sh -c "source /etc/profile"
HISTFILE=~/.histfile
HISTSIZE=99999
@ -34,20 +34,13 @@ setopt path_dirs # Perform path search even on command names with
setopt rc_quotes # 'it''s okay' becomes "it's okay"
unsetopt flow_control # Disable start/stop characters in shell editor.
function {
if [ "$SHLVL" -le 1 ] \
&& [ "${TERM#screen}" = "$TERM" ] \
&& [ "${TERM#tmux}" = "$TERM" ] \
&& (( $+commands[tmux] ))
then
if [ "$SHLVL" -le 1 ] && [ "$TERM" = "${TERM#screen}" ] && [ "$TERM" = "${TERM#tmux}" ]; then
if (( $+commands[tmux] )); then
# create a new session called "what" or attach if it already exists
local env=(LANG="en_US.UTF-8" TZ=":/etc/localtime")
local cmd=(tmux new -A -s what)
[ "${TTY#/dev/cons}" = "$TTY" ] || cmd=(script -qfec "$cmd" /dev/null)
env $env $cmd && exit
LANG="en_US.UTF-8" TZ=":/etc/localtime" tmux new -A -s what && exit
printf '\e[91m\ntmux died (%i), continuing...\n\e[0m\n' $?
fi
}
fi
autoload -U zmv
autoload -U zrecompile
@ -62,8 +55,8 @@ function {
# combine everything matching "YES_ZSH" in ~/sh/ into ~/.sh,
# but only recompile the output if the sha1sum has changed.
[ -s ~/.sh.sha1 ] && read -r b _ < ~/.sh.sha1
( cd ~/sh \
&& print -l '#!/usr/bin/env false' '[ -n "$preload" ] || exit 1' '' \
( cd ~/sh \
&& print -l '#!/usr/bin/env false' '[ -n "$preload" ] || exit 1' '' \
| cat - $(grep -lF YES_ZSH -- *~*.bak(.)) \
| tee ~/.sh \
) | sha1sum - \
@ -195,7 +188,7 @@ else
hash -d py=~/Dropbox/py
fi
. ~/.shrc
. ~/.-shrc
alias -g OMFG="1>/dev/null" ### @ OMFG - silence stdout.
alias -g STFU="2>/dev/null" ### @ STFU - silence stderr.

View File

@ -130,7 +130,7 @@ cd "${HOME:?HOME variable empty or unset}" || die "failed to change directory"
backup_dir="$rc/backup-$(date -u '+%s')"
[ ! -d "$backup_dir" ] || die "backup directory already exists"
for f in .shrc .bashrc .zshrc .prep .prezto-compinit .ls_colors \
for f in .bashrc .zshrc .-shrc .prezto-compinit .ls_colors \
.vimrc .inputrc .Xresources .screenrc .tmux.conf; do
hardlink "$f" "$rc/home/${f#.}"
done

View File

@ -59,7 +59,7 @@ else
#( cd temp; HOME="$rc/temp" dash ./install )
ln temp/home/zshrc temp/.zshrc || die 'failed to copy files'
ln temp/home/shrc temp/.shrc || die 'failed to copy files'
ln temp/home/-shrc temp/.-shrc || die 'failed to copy files'
ln temp/home/bashrc temp/.bashrc || die 'failed to copy files'
# use new documentation-generating scripts on old shell scripts.

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# YES_ZSH
# YES_BASH
# YES_DASH
# YES_ASH
colors2() {
[ $# -eq 0 ] || { printf "%s\n" "$0: does not take arguments" >&2; return 1; }
for a in 0 60; do
for b in 0 60; do
for i in 30 31 33 32 36 34 35 37; do
for j in 40 41 43 42 46 44 45 47; do
printf ' \033[%s;%sm %03d \033[m' $((a+j)) $((b+i)) $((a+j))
done
printf '\n'
done
done
[ $a = 0 ] && printf '\n'
done
}
[ -n "${preload+-}" ] || colors2 "$@"

View File

@ -63,7 +63,7 @@ compile() { ### @-
### # debug build
### compile rd.c
### compile debug rd.c
### # debug build with warning/error flags defined in ~/sh/arrays
### # debug build with warning/error flags defined in .-shrc
### # (requires .zshrc for global alias expansion)
### compile WHOA rd.c
### # likewise for C++

View File

@ -23,8 +23,6 @@ decently() ( ### @-
find "$dir" -type f "$@" \
'!' \
'(' -path '*/.git/*' \
-or -path '*/CVS/*' \
-or -path '*/CVSROOT/*' \
-or -path '*/__pycache__/*' \
-or -path '*/[Dd]esktop.ini' \
-or -path '*/Thumbs.db' \

View File

@ -1,5 +1,9 @@
#!/usr/bin/env dash
# FAKE_COMPAT
# NO_ZSH
# NO_BASH
# YES_DASH
# YES_ASH
# okay, so this probably does run with zsh and bash, but why bother?
# NOTE: a lot of boilerplate code is pulled from the pure sh bible:
# https://github.com/dylanaraps/pure-sh-bible
@ -108,7 +112,7 @@ document1() {
fi
# sanity check:
[ -d sh ] && [ -f .zshrc ] && [ -f .shrc ] && [ -f .bashrc ] || return 3
[ -d sh ] && [ -f .zshrc ] && [ -f .-shrc ] && [ -f .bashrc ] || return 3
# create new output file (with a tilde as not to overwrite just yet):
: > "$out" || return 4
@ -140,7 +144,7 @@ document1() {
printf '\n## %s\n' 'miscellaneous' >> "$out" || return 5
document2 .zshrc >> "$out" || return
document2 .bashrc >> "$out" || return
document2 .shrc >> "$out" || return
document2 .-shrc >> "$out" || return
}
document() { ### @-

View File

@ -1,25 +0,0 @@
#!/usr/bin/env sh
# YES_ZSH
# YES_BASH
# YES_DASH
# YES_ASH
v_domap() {
argc $# -eq 1 "$0" || return
# TODO: sanity-check on characters of the variable name.
local _k_="$1" _v_= _new_= _next_= _i_= _o_=
eval "_v_=\"\$$_k_\""
while [ -n "$_v_" ]; do
_next_="${_v_#[! ]}"
[ "$_next_" != "$_v_" ] || _next_="${_v_# }"
_i_="${_v_%"$_next_"}"; _v_="$_next_"
map
_new_="$_new_$_o_"
#printf 'new: %s\n' "$_new_"
done
eval "$_k_=\"\$_new_\""
}
[ -n "${preload+-}" ] || . ~/sh/preload || exit 2
eval ${preload:-preload} argc
[ -n "${preload+-}" ] || v_domap "$@"

View File

@ -1,22 +0,0 @@
#!/usr/bin/env sh
# YES_ZSH
# YES_BASH
# YES_DASH
# YES_ASH
v_lower() { ### @- transform the contents of a variable to lowercase.
argc $# -eq 1 "$0" || return
map() {
case "$_i_" in
(A) _o_=a;; (B) _o_=b;; (C) _o_=c;; (D) _o_=d;; (E) _o_=e;; (F) _o_=f;; (G) _o_=g;;
(H) _o_=h;; (I) _o_=i;; (J) _o_=j;; (K) _o_=k;; (L) _o_=l;; (M) _o_=m;; (N) _o_=n;;
(O) _o_=o;; (P) _o_=p;; (Q) _o_=q;; (R) _o_=r;; (S) _o_=s;; (T) _o_=t;; (U) _o_=u;;
(V) _o_=v;; (W) _o_=w;; (X) _o_=x;; (Y) _o_=y;; (Z) _o_=z;; (*) _o_="$_i_";;
esac
}
v_domap "$1"
}
[ -n "${preload+-}" ] || . ~/sh/preload || exit 2
eval ${preload:-preload} argc v_domap
[ -n "${preload+-}" ] || v_lower "$@"

View File

@ -1,22 +0,0 @@
#!/usr/bin/env sh
# YES_ZSH
# YES_BASH
# YES_DASH
# YES_ASH
v_upper() { ### @- transform the contents of a variable to uppercase.
argc $# -eq 1 "$0" || return
map() {
case "$_i_" in
(a) _o_=A;; (b) _o_=B;; (c) _o_=C;; (d) _o_=D;; (e) _o_=E;; (f) _o_=F;; (g) _o_=G;;
(h) _o_=H;; (i) _o_=I;; (j) _o_=J;; (k) _o_=K;; (l) _o_=L;; (m) _o_=M;; (n) _o_=N;;
(o) _o_=O;; (p) _o_=P;; (q) _o_=Q;; (r) _o_=R;; (s) _o_=S;; (t) _o_=T;; (u) _o_=U;;
(v) _o_=V;; (w) _o_=W;; (x) _o_=X;; (y) _o_=Y;; (z) _o_=Z;; (*) _o_="$_i_";;
esac
}
v_domap "$1"
}
[ -n "${preload+-}" ] || . ~/sh/preload || exit 2
eval ${preload:-preload} argc v_domap
[ -n "${preload+-}" ] || v_upper "$@"