Skip to content

Instantly share code, notes, and snippets.

@bitst0rm
Created May 3, 2015 23:03
Show Gist options
  • Save bitst0rm/ca882768c537d619d391 to your computer and use it in GitHub Desktop.
Save bitst0rm/ca882768c537d619d391 to your computer and use it in GitHub Desktop.
Simple script to generate host list for https://github.com/Owyn/HandyImage
#!/usr/bin/sh
# Script to generate host list and check for dead hosts
echo "Generating supported host list..."
sed -n 's/.*case "\(.*\)":.*/\1/p' HandyImage.user.js | sort | uniq > supported-host-list.txt
read -p "Do you want to check broken hosts? (y/n)" RESP
if [ "$RESP" = "y" ]; then
echo "Checking broken hosts..."
while read URL; do
RESULT=$(curl -s -o /dev/null --connect-timeout 2 -w%{http_code} ${URL})
echo "[${RESULT}] ${URL}"
done < supported-host-list.txt | sort > broken-host-list.txt
fi
echo "Done."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment