Skip to content

Instantly share code, notes, and snippets.

@tbarsbay
Created October 3, 2017 19:19
Show Gist options
  • Save tbarsbay/b7d10679abe76655d078b20340f3291b to your computer and use it in GitHub Desktop.
Save tbarsbay/b7d10679abe76655d078b20340f3291b to your computer and use it in GitHub Desktop.
Generate thoughts and prayers without a second thought!
# Generate thoughts and prayers without a second thought!
RSS="`wget -qO- http://rss.nytimes.com/services/xml/rss/nyt/US.xml`"
printf "Scanning New York Times headlines...\n"
getnextxml () {
local IFS=\>
read -d \< ENTITY CONTENT
}
while getnextxml; do
if [[ $ENTITY = "title" ]]; then
TITLE=$CONTENT
if [[ $TITLE == *"Shooting"* ]]; then
printf "Found a mass casualty event\n"
fi
fi
done <<< "$RSS"
printf "Generating thoughts and prayers...\n\n"
sleep 3
L=(" " "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z")
F=(15 11 1 25 0 25 15 21 0 3 1 21 7 8 20 0 13 5 0 9 0 4 9 4 14 20 0 1 3 20 21 1 12 12 25 0 23 18 9 20 5 0 1 0 18 5 1 12 0 19 3 18 9 16 20)
for i in ${!F[@]}; do
NUM=${F[i]}
printf "${L[NUM]}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment