Skip to content

Instantly share code, notes, and snippets.

@ternus
Created April 25, 2015 23:23
Show Gist options
  • Save ternus/906a153fd5041ee01f51 to your computer and use it in GitHub Desktop.
Save ternus/906a153fd5041ee01f51 to your computer and use it in GitHub Desktop.
Checks where you are on the Firefly waitlist and keeps you logged in so you don't miss out.
#!/bin/bash
ATHENA="ternus"
USERNAME="ternus@cternus.net"
PASSWORD=""
cwaitlistnum=''
while true; do
waitlistnum=$(curl -s -X POST https://tickets.fireflyartscollective.org/cgi-bin/ticketing.pl -F "email=$USERNAME" -F "password=$PASSWORD" -F "action=Log In" | pcregrep -o1 "(\d+) confirmed")
if [[ $waitlistnum == '' ]]; then
zwrite -d $ATHENA -m "Either you're now off the waitlist or something went wrong."
break
fi
if [[ $waitlistnum != $cwaitlistnum ]]; then
zwrite -d $ATHENA -m "You're now number $waitlistnum on the Firefly waitlist."
cwaitlistnum=$waitlistnum
fi
sleep 60
done
@apsulli
Copy link

apsulli commented May 25, 2016

hey this is pretty neat. for no really good reason I adjusted it slightly to return both total in the waitlist and active in the waitlist, and also to check every 10 minutes instead of 1 minute. I have no idea if this will be useful to you at all but just for giggles, enjoy.

#!/bin/bash

USERNAME="[USERNAME]"
PASSWORD="[PASSWORD]"

cwaitlistactive=''
while true; do
    ticketpage=$(curl -s -X POST https://tickets.fireflyartscollective.org/cgi-bin/ticketing.pl -F "email=$USERNAME" -F "password=$PASSWORD" -F "action=Log In")
    waitlisttot=$(echo "$ticketpage" | pcregrep -o1 "(\d+) confirmed")
    waitlistactive=$(echo "$ticketpage" | pcregrep -o1 "(\d+) of them are active")
    if [[ $waitlistactive == '' ]]; then
        echo "Either you're now off the waitlist or something went wrong."
        break
    fi
    if [[ $waitlistactive != $cwaitlistactive ]]; then
        echo "Firefly - Total waitlist place: $waitlisttot; Active waitlist place: $waitlistactive"
        cwaitlistactive=$waitlistactive
    fi
    sleep 600
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment