Skip to content

Instantly share code, notes, and snippets.

@AaronHarris
Created January 6, 2019 09:07
Show Gist options
  • Save AaronHarris/d761afa6ec5529da7e6950e9f8305cde to your computer and use it in GitHub Desktop.
Save AaronHarris/d761afa6ec5529da7e6950e9f8305cde to your computer and use it in GitHub Desktop.
Script I write to squat palindromic CR ids. I spent way too long on this.
read -p "Enter a string: " string
if [[ $(rev <<< $string) == "$string" ]]; then
echo Palindrome
fi
kcurl -s -o /dev/null -I -w "%{http_code}" https://cr.amazon.com/r/$FOO
curl -s http://www.example.com | sed -e 's#<!doctype.*##gm' | xpath '/html/body/div/h1/text()'
crlink=`kcurl -s https://cr.amazon.com/r/ | xmllint --html --xpath 'string(//*[@id="datagrid-0"]/div[2]/table/tbody/tr[1]/td[2]/a/@href)' 2>/dev/null -`
cr=${latestcr//[\/r]/}
((pre=cr/1000))
pal=$[pre * 1000 + $(rev <<< $[pre/10])]
if (( pal < cr )); then
pal=$[((pre+1)) * 1000 + $(rev <<< $[pre/10])]
fi
paldiff=$[pal-cr]
echo "There are $paldiff CRs to go until palindromic CR $pal"
read -p "Press enter to start watching $[pal-1]"
while status=`kcurl -s -o /dev/null -I -w "%{http_code}" https://cr.amazon.com/r/$[pal-1]`; do
echo $status
if (( status == 200 )); then
post-review;
exit 0;
fi
sleep 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment