├── .gitignore ├── LICENSE ├── README.md ├── cows ├── Abra.cow ├── Aerodactyl.cow ├── Alakazam.cow ├── Arbok.cow ├── Arcanine.cow ├── Articuno.cow ├── Beedrill.cow ├── Bellsprout.cow ├── Blastoise.cow ├── Bulbasaur.cow ├── Butterfree.cow ├── Caterpie.cow ├── Chansey.cow ├── Charizard.cow ├── Charmander.cow ├── Charmeleon.cow ├── Clefable.cow ├── Clefairy.cow ├── Cloyster.cow ├── Cubone.cow ├── Dewgong.cow ├── Diglett.cow ├── Ditto.cow ├── Dodrio.cow ├── Doduo.cow ├── Dragonair.cow ├── Dragonite.cow ├── Dratini.cow ├── Drowzee.cow ├── Dugtrio.cow ├── Eevee.cow ├── Ekans.cow ├── Electabuzz.cow ├── Electrode.cow ├── Exeggcute.cow ├── Exeggutor.cow ├── Farfetch'd.cow ├── Fearow.cow ├── Flareon.cow ├── Gastly.cow ├── Gengar.cow ├── Geodude.cow ├── Gloom.cow ├── Golbat.cow ├── Goldeen.cow ├── Golduck.cow ├── Golem.cow ├── Graveler.cow ├── Grimer.cow ├── Growlithe.cow ├── Gyarados.cow ├── Haunter.cow ├── Hitmonchan.cow ├── Hitmonlee.cow ├── Horsea.cow ├── Hypno.cow ├── Ivysaur.cow ├── Jigglypuff.cow ├── Jolteon.cow ├── Jynx.cow ├── Kabuto.cow ├── Kabutops.cow ├── Kadabra.cow ├── Kakuna.cow ├── Kangaskhan.cow ├── Kingler.cow ├── Koffing.cow ├── Krabby.cow ├── Lapras.cow ├── Lickitung.cow ├── Machamp.cow ├── Machoke.cow ├── Machop.cow ├── Magikarp.cow ├── Magmar.cow ├── Magnemite.cow ├── Magneton.cow ├── Mankey.cow ├── Marowak.cow ├── Meowth.cow ├── Metapod.cow ├── Mew.cow ├── Mewtwo.cow ├── Moltres.cow ├── Mr. Mime.cow ├── Muk.cow ├── Nidoking.cow ├── Nidoqueen.cow ├── Nidoran♀.cow ├── Nidoran♂.cow ├── Nidorina.cow ├── Nidorino.cow ├── Ninetales.cow ├── Oddish.cow ├── Omanyte.cow ├── Omastar.cow ├── Onix.cow ├── Paras.cow ├── Parasect.cow ├── Persian.cow ├── Pidgeot.cow ├── Pidgeotto.cow ├── Pidgey.cow ├── Pikachu.cow ├── Pinsir.cow ├── Poliwag.cow ├── Poliwhirl.cow ├── Poliwrath.cow ├── Ponyta.cow ├── Porygon.cow ├── Primeape.cow ├── Psyduck.cow ├── Raichu.cow ├── Rapidash.cow ├── Raticate.cow ├── Rattata.cow ├── Rhydon.cow ├── Rhyhorn.cow ├── Sandshrew.cow ├── Sandslash.cow ├── Scyther.cow ├── Seadra.cow ├── Seaking.cow ├── Seel.cow ├── Shellder.cow ├── Slowbro.cow ├── Slowpoke.cow ├── Snorlax.cow ├── Spearow.cow ├── Squirtle.cow ├── Starmie.cow ├── Staryu.cow ├── Tangela.cow ├── Tauros.cow ├── Tentacool.cow ├── Tentacruel.cow ├── Vaporeon.cow ├── Venomoth.cow ├── Venonat.cow ├── Venusaur.cow ├── Victreebel.cow ├── Vileplume.cow ├── Voltorb.cow ├── Vulpix.cow ├── Wartortle.cow ├── Weedle.cow ├── Weepinbell.cow ├── Weezing.cow ├── Wigglytuff.cow ├── Zapdos.cow └── Zubat.cow ├── example.png ├── fix_images.sh ├── install.sh ├── make_cows.sh ├── pokemonsay.sh ├── pokemonthink.sh └── scrap_data.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore downloaded files. 2 | scrapped-data/ 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Lucas Possatti 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /cows/Abra.cow: -------------------------------------------------------------------------------- 1 | binmode STDOUT, ":utf8"; 2 | $the_cow =< $bin_path/$pokemonsay_bin <<- EOF 21 | #!/bin/sh 22 | 23 | # This script changes to the pokemonsay installation directory, 24 | # runs the main script for running the pokemonsay, and changes 25 | # back to the previous directory. 26 | 27 | cd $install_path/ 28 | ./pokemonsay.sh \$@ 29 | cd - >/dev/null 30 | EOF 31 | 32 | # Create the pokemonthink script in the home bin directory. 33 | cat > $bin_path/$pokemonthink_bin <<- EOF 34 | #!/bin/sh 35 | 36 | # This script changes to the pokemonsay installation directory, 37 | # runs the main script for running the pokemonthink, and changes 38 | # back to the previous directory. 39 | 40 | cd $install_path/ 41 | ./pokemonthink.sh \$@ 42 | cd - >/dev/null 43 | EOF 44 | 45 | # Create uninstall script in the install directory 46 | cat > $install_path/uninstall.sh <<- EOF 47 | #!/bin/sh 48 | 49 | # 50 | # This script uninstalls pokemonsay. 51 | # 52 | 53 | # Remove the install directory 54 | rm -r "$install_path/" 55 | 56 | # Remove the bin files 57 | rm "$bin_path/$pokemonsay_bin" 58 | rm "$bin_path/$pokemonthink_bin" 59 | 60 | # Say what's going on. 61 | echo "'$install_path/' directory was removed." 62 | echo "'$bin_path/$pokemonsay_bin' file was removed." 63 | echo "'$bin_path/$pokemonthink_bin' file was removed." 64 | EOF 65 | 66 | # Change permission of the generated scripts 67 | chmod +x "$bin_path/$pokemonsay_bin" 68 | chmod +x "$bin_path/$pokemonthink_bin" 69 | chmod +x "$install_path/uninstall.sh" 70 | 71 | echo "The files were installed to '$install_path/'." 72 | echo "A '$pokemonsay_bin' script was created in '$bin_path/'." 73 | echo "A uninstall script was created in '$install_path/'." 74 | echo "It may be necessary to logout and login back again in order to have the '$pokemonsay_bin' available in your path." 75 | -------------------------------------------------------------------------------- /make_cows.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Transform image files pixel per pixel into cow files. 5 | # 6 | 7 | for fullfilename in ./scrapped-data/*.png 8 | do 9 | filename=$(basename "$fullfilename") 10 | extension="${filename##*.}" 11 | filename="${filename%.*}" 12 | img2xterm --cow "$fullfilename" "cows/$filename.cow" 13 | done 14 | -------------------------------------------------------------------------------- /pokemonthink.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Call pokemonsay with the think option. 5 | # 6 | 7 | ./pokemonsay.sh --think $@ 8 | -------------------------------------------------------------------------------- /scrap_data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # This script scraps some pokémon pictures from Bulbapedia. 5 | # 6 | 7 | bulbapedia_page_url="http://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_Kanto_Pok%C3%A9dex_number" 8 | bulbapedia_page_name="bulbapedia.html" 9 | scrap_folder="`pwd`/scrapped-data" 10 | 11 | # Make sure the directory for the scrapped data is there. 12 | mkdir -p "$scrap_folder" 13 | 14 | # Download the bulbapedia page if it doesn't already. 15 | if [ ! -e "scrapped-data/bulbapedia.html" ]; then 16 | echo " > Downloading '$bulbapedia_page_url' to '$scrap_folder/$bulbapedia_page_name' ..." 17 | wget "$bulbapedia_page_url" -O "$scrap_folder/$bulbapedia_page_name" -q 18 | echo " > Downloaded." 19 | fi 20 | 21 | # Dear furure me, 22 | # 23 | # If you are in need to maintain this part of the code... I am 24 | # realy sorry for you (T.T). This was the best I could do... But 25 | # I will try to explain things here a little bit. 26 | # 'cat' will read the file and pipe its output to 'sed'. 'sed' 27 | # will filter the html searching for the Pokémon name and its 28 | # image url. 'sed' will output the Pokémons in this format: 29 | # "=". And the output of 'sed' will be 30 | # stored in a variable we will use later. 31 | # Then, the content of the variable will be read one line at a 32 | # time in the for loop. Within the for loop, I extract the pokemon 33 | # name and the url from the read line. And then, it just downloads 34 | # the content of the url to a file. 35 | # Again... I'm sorry for all the trouble. But I hope you will 36 | # grow stronger and may be able to turn this code into something 37 | # more readable. 38 | # 39 | # Kind regards, 40 | # Yourself from the past. 41 | 42 | pokemon_images=$( 43 | cat "$scrap_folder/$bulbapedia_page_name" | \ 44 | sed -nr 's;^.*(.*).*$;\1=\2;p' \ 45 | ) 46 | 47 | for line in $pokemon_images; do 48 | pokemon_name="${line%=*}" 49 | pokemon_url="${line#*=}" 50 | 51 | # Unescape HTML characters... Damn "Farfetch'd". 52 | pokemon_name=$(echo "$pokemon_name" | sed "s/'/'/") 53 | 54 | # If wget is interrupted by a SIGINT or something, it will 55 | # leave a broken file. Let's remove it and exit in case we 56 | # receive a signal like this. 57 | # Signals: (1) SIGHUP; (2) SIGINT; (15) SIGTERM. 58 | trap "rm $scrap_folder/$pokemon_name.png; echo Download of $pokemon_name was cancelled; exit" 1 2 15 59 | 60 | echo " > Downloading '$pokemon_name' from '$pokemon_url' to '$scrap_folder/$pokemon_name.png' ..." 61 | wget "$pokemon_url" -O "$scrap_folder/$pokemon_name.png" -q 62 | done 63 | --------------------------------------------------------------------------------