Skip to content

Instantly share code, notes, and snippets.

@haskie-lambda
Created May 25, 2021 18:07
Show Gist options
  • Save haskie-lambda/64e6e4f515369450aac37dba59e639f3 to your computer and use it in GitHub Desktop.
Save haskie-lambda/64e6e4f515369450aac37dba59e639f3 to your computer and use it in GitHub Desktop.
the wise cow and some other wise entities spreading random life advice
cowcite(){
args=(-b -d -g -L -n -N -p -s -t -w -y);
animals=(bong bud-frogs bunny cower daemon default dragon dragon-and-cow default elephant default ghostbusters head-in default kiss kosh default milk moofasa moose mutilated default sheep skeleton stegosaurus default three-eyes turkey turtle tux default www);
arg=${args[ $(( RANDOM % 13 )) ]};
animal=${animals[ $(( RANDOM % 32 )) ]};
curl -s http://bash.org/\?random |
grep -E '<p class="qt">.*</p>' |
head -n 1 |
sed -E 's%.*<p class="qt">(.*)</p>.*%\1%' |
sed -e 's/&amp;/&/g; s/\&lt;/</g; s/\&gt;/>/g; s/\&quot;/"/g; s/\&#39;/'"'"'/g' |
cowsay -f "$animal" "$arg" -- ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment