#!/bin/bash
# usage: scrub.sh "['k1','k2']" "[5,0]" OUT PORT
D=${SCRUB_DIR:-/tmp}; cp "$(dirname "$0")/58k_scrub.js" $D/scrub.js
sed -e "s/__KEYS__/$1/" -e "s/__GS__/$2/" $D/scrub.js > $D/_scrub_$3.js
cd /Users/basha/.claude/jobs/59bcb149/tmp
node kwperf.mjs "http://127.0.0.1:8791/feedback/${SCRUB_PAGE:-58k_portalgun.html}" --port $4 --done "" --timeout 590 --eval "$(cat $D/_scrub_$3.js)" --w 800 > $D/_log_$3.txt 2>&1
grep -E "EVAL|console errors" $D/_log_$3.txt | cut -c1-2400
