1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-05-18 01:53:22 -07:00

mostly superficial tweaks

This commit is contained in:
Connor Olding 2023-06-16 03:30:43 +02:00
parent dce787f082
commit 5ad06fcd63
4 changed files with 12 additions and 2 deletions

View File

@ -4,6 +4,7 @@
# YES_DASH
# YES_ASH
# YES_BB_AWK
# YES_OT_AWK
countdiff() { ### @-
### count the number of lines changed between two files.
@ -18,7 +19,7 @@ countdiff() { ### @-
[ $# -gt 1 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }
[ $# -le 2 ] || { printf "%s\n" "$0: too many arguments" >&2; return 1; }
git --no-pager diff --stat --no-color --no-index "$1" "$2" \
| awk '/changed/{print $4+$6;a=1}END{if(!a)print 0}'
| awk ' /changed/{print $4+$6;a=1}END{if(!a)print 0}'
}
[ -n "${preload+-}" ] || countdiff "$@"

1
sh/dfu
View File

@ -4,6 +4,7 @@
# YES_DASH
# YES_ASH
# YES_BB_AWK
# YES_OT_AWK
dfu() { ### @-
### pretty-print `df` in GiB.

3
sh/oxo
View File

@ -25,6 +25,7 @@ oxo() { ### @-
### $ echo test | oxo
### https://0x0.st/sj2.txt
### oxo: successfully uploaded 1/1 file
###
### $ oxo ~/play/{hey,you,fake,empty}
### https://0x0.st/-3rz.txt
### oxo: expires in 365 days: /home/notwa/play/hey
@ -67,7 +68,7 @@ oxo() { ### @-
# restrict the filepath to simple ascii characters that curl likes.
if [ "$f" != "${f#*[! -~]}" ] || [ "$f" != "${f#*[\":<>?\\|]}" ]; then
# copy the user's file to a temporary path and use that instead.
g=/tmp/oxo
g=/tmp/oxo.tmp
#printf "$warn" "oxo: special characters found: $f" >&2
if ! cp -p -- "$f" "$g"; then
printf "$bad" "oxo: failed to copy file: $f" >&2

View File

@ -18,6 +18,13 @@ running() { ### @- WIP
(*) printf '%s\n' "$usage" >&2; return 2;;
esac
done
# ps -o pid,comm=CMD
# argumentless flags accepted by busybox:
# a d e f l A T Z
# argumentless flags accepted by coreutils:
# a c d e f g h j l m n r s t u v w x A F H L M N P S T V X Z
ps -f | awk -v cmd=$cmd -v pid=$pid '
NR==1{
s=index($0,"COMMAND")