Upload files to ''

This commit is contained in:
jan6 2020-07-06 17:05:08 -04:00
parent 504b4c31cc
commit 0a1fad6621
5 changed files with 48 additions and 0 deletions

5
add.sh Normal file
View File

@ -0,0 +1,5 @@
add() {
dc -e "$1 $2 + p"
#extra version
#dc -e "$1 $2 + 2 / p"
}

12
byte2dec.sh Normal file
View File

@ -0,0 +1,12 @@
byte2dec() {
printf "%s" "$1"|
od -A n -t d1|
tr -s "[:blank:]" "\n"|
tail -n +2|
while read i;do
echo "$i"|
awk '/^[^-]/{printf("%03d ", $0);};\
/^-/{print 256-substr($1,2)}'|
tr "[:space:]" " ";
done
}

8
count_bytes.sh Normal file
View File

@ -0,0 +1,8 @@
count_bytes() {
printf "%s" "$1"|od -A n -t x1|
tr -s "[:space:]"|
sed -e "1s/[[:space:]]//"\
-e "s/.../&\n/g"|
tr -s "[:space:]"|
wc -l
}

11
dec2byte.sh Normal file
View File

@ -0,0 +1,11 @@
dec2byte() {
printf "%s" "$1"|
tr " " "\n"|
while read i;do
echo "8 o $i p"|dc|
while read j;do
printf "\\$j";
done;
done;
echo
}

12
gen_sheet.sh Normal file
View File

@ -0,0 +1,12 @@
gen_sheet0() {
n="${1:-8}"
n="$(expr "$n" "*" "4")" # ↓↓↓ octal
grep -o "[[:digit:]]" -a /dev/urandom|grep [0-7]|
head -n "$n"|
tr -d "\n"|
sed -e "s/..../&\n/g";
echo;
}
gen_sheet() {
gen_sheet0 "$1"|tr -s "[:space:]"|tee sheet.txt
}