Last active
November 6, 2019 22:50
-
-
Save aabmass/259eaaf98ba5e0d6fe417e6f37405990 to your computer and use it in GitHub Desktop.
bash function (include in bashrc to work like an alias) to print a tweet from https://twitter.com/dog_feelings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dogthought { | |
rand_val=$((1 + RANDOM % 10)) | |
curl -s https://twitter.com/dog_feelings \ | |
| xmllint --html -xpath "(/html/body/descendant::div[contains(@class, 'js-tweet-text-container')]/p[contains(@class, 'tweet-text')])[${rand_val}]/text()" - 2>/dev/null \ | |
| cowsay -f <(curl -s https://gist.githubusercontent.com/aabmass/c4230d06daa7073d0fb537030ed7d05c/raw/960572ed504c576f58bb4d8d182f01a9aeb10f95/dog.cow) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment