2019-05-28 20:49:58 +00:00
#!/bin/bash
echo not a script
exit 1
2019-05-26 16:30:19 +00:00
##
## prep debug env (vscode embedded terminal)
renice 20 -p $$
2019-05-28 20:49:58 +00:00
##
## cleanup after a busted shutdown
ps ax | awk '/python[23]?[ ]-m copyparty/ {print $1}' | tee /dev/stderr | xargs kill
##
## create a test payload
head -c $(( 2 * 1024 * 1024 * 1024 )) /dev/zero | openssl enc -aes-256-ctr -pass pass:hunter2 -nosalt > garbage.file
2019-05-26 16:30:19 +00:00
##
## testing multiple parallel uploads
## usage: para | tee log
2019-06-18 18:33:31 +00:00
para( ) { for s in 1 2 3 4 5 6 7 8 12 16 24 32 48 64; do echo $s ; for r in { 1..4} ; do for ( ( n = 0; n<s; n++) ) ; do curl -sF "act=bput" -F "f=@garbage.file" http://127.0.0.1:1234/ 2>& 1 & done ; wait; echo; done ; done ; }
2019-05-26 16:30:19 +00:00
##
## display average speed
## usage: avg logfile
avg( ) { awk 'function pr(ncsz) {if (nsmp>0) {printf "%3s %s\n", csz, sum/nsmp} csz=$1;sum=0;nsmp=0} {sub(/\r$/,"")} /^[0-9]+$/ {pr($1);next} / MiB/ {sub(/ MiB.*/,"");sub(/.* /,"");sum+=$1;nsmp++} END {pr(0)}' " $1 " ; }
2019-05-30 13:17:45 +00:00
2019-06-10 19:47:01 +00:00
##
## bad filenames
2019-06-12 16:39:43 +00:00
dirs = ( " $HOME /vfs/ほげ " " $HOME /vfs/ほげ/ぴよ " " $HOME /vfs/ $( printf \\ xed\\ x91) " " $HOME /vfs/ $( printf \\ xed\\ x91/\\ xed\\ x92) " )
mkdir -p " ${ dirs [@] } "
for dir in " ${ dirs [@] } " ; do for fn in ふが " $( printf \\ xed\\ x93) " 'qwe,rty;asd fgh+jkl%zxc&vbn <qwe>"rty' "'" 'uio&asd fgh' ; do echo " $dir " > " $dir / $fn .html " ; done ; done
2019-06-10 19:47:01 +00:00
2019-06-26 18:26:18 +00:00
##
## test compression
wget -S --header= 'Accept-Encoding: gzip' -U 'MSIE 6.0; SV1' http://127.0.0.1:1234/.cpr/deps/ogv.js -O- | md5sum; p = ~ed/dev/copyparty/copyparty/web/deps/ogv.js.gz; md5sum $p ; gzip -d < $p | md5sum
2019-05-30 13:17:45 +00:00
##
## vscode
# replace variable name
# (^|[^\w])oldname([^\w]|$) => $1newname$2