mirror of
https://github.com/notwa/rc
synced 2025-02-05 07:43:22 -08:00
mostly superficial tweaks
This commit is contained in:
parent
dce787f082
commit
5ad06fcd63
4 changed files with 12 additions and 2 deletions
|
@ -4,6 +4,7 @@
|
||||||
# YES_DASH
|
# YES_DASH
|
||||||
# YES_ASH
|
# YES_ASH
|
||||||
# YES_BB_AWK
|
# 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.
|
||||||
|
@ -18,7 +19,7 @@ countdiff() { ### @-
|
||||||
[ $# -gt 1 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }
|
[ $# -gt 1 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }
|
||||||
[ $# -le 2 ] || { printf "%s\n" "$0: too many 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" \
|
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 "$@"
|
[ -n "${preload+-}" ] || countdiff "$@"
|
||||||
|
|
1
sh/dfu
1
sh/dfu
|
@ -4,6 +4,7 @@
|
||||||
# YES_DASH
|
# YES_DASH
|
||||||
# YES_ASH
|
# YES_ASH
|
||||||
# YES_BB_AWK
|
# YES_BB_AWK
|
||||||
|
# YES_OT_AWK
|
||||||
|
|
||||||
dfu() { ### @-
|
dfu() { ### @-
|
||||||
### pretty-print `df` in GiB.
|
### pretty-print `df` in GiB.
|
||||||
|
|
3
sh/oxo
3
sh/oxo
|
@ -25,6 +25,7 @@ oxo() { ### @-
|
||||||
### $ echo test | oxo
|
### $ echo test | oxo
|
||||||
### https://0x0.st/sj2.txt
|
### https://0x0.st/sj2.txt
|
||||||
### oxo: successfully uploaded 1/1 file
|
### oxo: successfully uploaded 1/1 file
|
||||||
|
###
|
||||||
### $ oxo ~/play/{hey,you,fake,empty}
|
### $ oxo ~/play/{hey,you,fake,empty}
|
||||||
### https://0x0.st/-3rz.txt
|
### https://0x0.st/-3rz.txt
|
||||||
### oxo: expires in 365 days: /home/notwa/play/hey
|
### oxo: expires in 365 days: /home/notwa/play/hey
|
||||||
|
@ -67,7 +68,7 @@ oxo() { ### @-
|
||||||
# restrict the filepath to simple ascii characters that curl likes.
|
# restrict the filepath to simple ascii characters that curl likes.
|
||||||
if [ "$f" != "${f#*[! -~]}" ] || [ "$f" != "${f#*[\":<>?\\|]}" ]; then
|
if [ "$f" != "${f#*[! -~]}" ] || [ "$f" != "${f#*[\":<>?\\|]}" ]; then
|
||||||
# copy the user's file to a temporary path and use that instead.
|
# 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
|
#printf "$warn" "oxo: special characters found: $f" >&2
|
||||||
if ! cp -p -- "$f" "$g"; then
|
if ! cp -p -- "$f" "$g"; then
|
||||||
printf "$bad" "oxo: failed to copy file: $f" >&2
|
printf "$bad" "oxo: failed to copy file: $f" >&2
|
||||||
|
|
|
@ -18,6 +18,13 @@ running() { ### @- WIP
|
||||||
(*) printf '%s\n' "$usage" >&2; return 2;;
|
(*) printf '%s\n' "$usage" >&2; return 2;;
|
||||||
esac
|
esac
|
||||||
done
|
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 '
|
ps -f | awk -v cmd=$cmd -v pid=$pid '
|
||||||
NR==1{
|
NR==1{
|
||||||
s=index($0,"COMMAND")
|
s=index($0,"COMMAND")
|
||||||
|
|
Loading…
Add table
Reference in a new issue