Created
June 1, 2018 20:16
-
-
Save robertmaxwilliams/0adab6cd0667bddef3b678f46a424eea to your computer and use it in GitHub Desktop.
This file contains 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
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO: make into a nice command line tool, with text file as an argument and automatically collect list of cows.