Skip to content

Instantly share code, notes, and snippets.

@robertmaxwilliams
Created June 1, 2018 20:16
Show Gist options
  • Save robertmaxwilliams/0adab6cd0667bddef3b678f46a424eea to your computer and use it in GitHub Desktop.
Save robertmaxwilliams/0adab6cd0667bddef3b678f46a424eea to your computer and use it in GitHub Desktop.
import random
import subprocess
import shlex
cows = ['apt', 'beavis.zen', 'bong', 'bud-frogs', 'bunny', 'calvin', 'cheese', 'cock', 'cower',
'daemon', 'default', 'dragon', 'dragon-and-cow', 'duck', 'elephant', 'elephant-in-snake',
'eyes', 'flaming-sheep', 'ghostbusters', 'gnu', 'head-in', 'hellokitty', 'kiss', 'kitty',
'koala', 'kosh', 'luke-koala', 'mech-and-cow', 'meow', 'milk', 'moofasa', 'moose',
'mutilated', 'pony', 'pony-smaller', 'ren', 'sheep', 'skeleton', 'snowman',
'sodomized-sheep', 'stegosaurus', 'stimpy', 'suse', 'three-eyes', 'turkey', 'turtle', 'tux',
'unipony', 'unipony-smaller', 'vader', 'vader-koala', 'www']
with open('illiad.txt') as f:
for line in f:
if len(line) > 10:
quoted = shlex.quote(line)
bash_command = "echo %s | cowsay -f %s" % (quoted, random.choice(cows))
output = subprocess.check_output(['bash','-c', bash_command])
print(output.decode())
print()
input()
@robertmaxwilliams
Copy link
Author

TODO: make into a nice command line tool, with text file as an argument and automatically collect list of cows.

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