Skip to content

Instantly share code, notes, and snippets.

@hostmaster
Last active November 3, 2020 15:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hostmaster/5927056 to your computer and use it in GitHub Desktop.
Save hostmaster/5927056 to your computer and use it in GitHub Desktop.
#!/bin/bash
URL=http://www.mythic-beasts.com/cgi-bin/job.pl
curl -s ${URL} |
gawk '
/Evaluate/ {
gsub (/([[:alpha:]]|[[:space:]]|[,.<>/])/,"", $0);
print $0 |& "bc";
"bc" |& getline res;
a=sprintf("answer=%d", res);
}
/\"id\"=/ {
sub ("value","id", $4);
gsub(/\"/,"",$4); h=$4;
}
END {
print a"&"h"&submit=submit"
}
' | curl -d @- ${URL}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment