Skip to content

Instantly share code, notes, and snippets.

@tjb0607
Last active December 19, 2015 23:09
Show Gist options
  • Save tjb0607/6032910 to your computer and use it in GitHub Desktop.
Save tjb0607/6032910 to your computer and use it in GitHub Desktop.
Dependencies: bash (bash, grep, sed, echo, date), gawk, bc
#!/bin/bash
cd ~/.primecoin
touch ./primerate.txt
grep "prime/h" ./debug.log | sed "s/primemeter //" | sed "s/ prime\/h .*\/h//" >> ./primerate.txt
echo "" > ./debug.log
totalprimes=$(echo $(cat primerate.txt | sed "s/.*013.*:.* //" | awk '{if(min==""){min=max=$1}; if($1>max) {max=$1}; if($1<min) {min=$1}; total+=$1; count+=1} END {print int(total)}')/60|bc -l)
totaltimemined=$(echo $(date +%s)-$(date -u -d "$(head -n 1 .//primerate.txt|sed s/'\w*$'//)" +%s)+60|bc -l)
avgpps=$(echo "scale=2; $totalprimes/$totaltimemined"|bc -l)
echo $avgpps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment