Llama Cat (software)


I wrote some python that many of you might appreciate.

Not too long ago I wrote some code to make a Markov Chain from a text and spit out a string of gibberish in the style of said text. This is similar to when you use predictive text to put a string of words together that uses words like you do but doesn’t quite make sense. So… incredibly useful.

Well, I had it read some of my fiction and spit out some phrases, which I posted on the TwitterFace and people seemed to get a kick out of it.

For example, after reading a bunch of my shorts it said (all the punctuation and capitalization were there already, but I did delete some spaces to make them prettier):

  • temporarily contemplating if I caught myself to slip into his wormhole theory. When I watched him. Most people
  • “Haha!” “I’ll call up Megalos’ pant-leg. Then, a good amount he would make his body. I’m dead in shadows.
  • If the woman had killed her seat across the dildo, ominous shadows in love
  • One towel and the crap out

And, after reading Moby Dick, it said:

  • adieux. Grace being made me. But go to no fear of him; but from foreign seas
  • Strange!” holding them in the poet of Elephanta, if ascending the Soloma islands, quite another precautionary motive more I guess.
  • New Bedford rose and repose, and rubbing his own sober reason to heighten its perilous contortions be closed eyes

Both sets are obviously nonsense, but they each have a very different feel because they were trained by very different texts. Apparently I am not Herman Melville.

Because people seemed entertained, I decided to clean it up and write a GUI for it. It’s now on Github (Also, I wanted to get some new stuff up on Github because I’m job hunting).

I named it LlamaCat because I wanted a logo for it and had a cartoon I drew a while back of a cat riding a llama into battle… and “Llama Cat” sounds like a thing it would say.

The link to the python code is here: https://github.com/imasillypirate/LlamaCat

If you want to run it with python, you’ll need python 2.7 installed and you’ll need the LlamaCat.gif in the same folder where you plan to execute LlamaCat.py. It will also require a text document (.txt) including the work you’d like it to read. Longer works lead to more interesting results, but they can take a while.

If you’re on a Windows machine, you can download the .zip file instead which contains an executable and everything you should need, aside from the text document.

You can find the .zip file here: https://www.dropbox.com/s/fcieyjfqbcu0dda/LlamaCat.zip

Just unzip the file, then open the directory and double click LlamaCat.exe… If your antivirus lets you launch a .exe written by some random pirate on the internet, then you should be fine.

A great source of texts is Project Gutenberg: https://www.gutenberg.org/

You’ll want the plain text version of whatever book you pull down.

Go ahead and play with it. Feel free to let me know if you have questions, comments, or if it says something particularly funny (or creepy)!


How time gets spent while unemployed


The Prize

“For my prize,” the hero demanded, “you shall create for me a hunting companion.”

The god hung his head and sighed, “to what specifications, mortal?”

“Cross the mightiest pack hunter with the deadliest killer.”

“You want me to… cross a wolf with a snake?”

“Obey! Or so help me, I will unleash such-“

“Okay, okay. Hold on. I’ll make you your fucking dachshund.”

Villain Mash-up


I drew a science fiction villain mash-up!
How many can you identify?

As usual, you can get this design on RedBubble:

LED Cylon Scanner in Fencing Helmet

For the last 9 months, I’ve been learning light saber with San Diego Sabers. They are an amazing group full fantastic nerds of every sort. I’ll miss them quite a bit when I move to San Jose in 2 weeks. If you’re in the San Diego area, check them out.

…But that’s not what this post is about.

I recently decided to mod my helmet to add an LED Cylon scanner and, for those that are curious, this is how I did it.


(I did not make the light saber. That came from Ultra Sabers.)

First, I’d like to say that I am aware that there are other, cleaner, and easier ways to do this. I made mine entirely using stuff I already had.

-Fencing helmet with removable lining (mine is made by LINEA Fencing Gear, and I got it at the Fencing Post in Escondido, Ca)
-Arduino Micro and mini usb cable to connect to a computer with the arduino IDE (Not the cheapest buying option, but this is the one I’m using)
-Wires (You are going to want a bunch, thin-ish guage. You may want wire strippers, solder, and a soldering iron)
-Red LEDs (I used the reds from this set of LEDs)
-9V battery connector
-9V battery
-Electrical tape
-Switch (I’m using a big green toggle switch because that’s what I had, but any switch should work)
-Velcro (I used this because of the adhesive and wide strip)
-Small solderless breadboard (This one is optional if you want to solder to the Arduino, but I used one of these)

Here is the Arduino code (Sorry about the sloppy indents, WordPress kept changing them, so I gave up):
int nLed = 7;//number of LEDs
int ledPin[] = {13,3,5,6,9,10,11};//list of PWM pins
int ledHi = 100; //value for center LED
int ledMid = 10; //value for LEDs directly adjacent to center LED
int ledLow = 1; //value for dim LEDs

void lightUp(int num){// Light up the num-th pin in the ledPin
//along with 2 LEDs on either side of decreasing brightness

for (int i2=0;i2<=nLed-1;i2++){//Turn off everyone

if (num == -1){//center is off the low end

else if (num == nLed){//center is off the high end

else {//center is in an actual LED
analogWrite(ledPin[num],ledHi);//light up center

if (num >= 1){//LED just before center exists
analogWrite(ledPin[num-1],ledMid); //Light up LED just before center

if (num <= nLed-2){//LED just after center exists
analogWrite(ledPin[num+1],ledMid); //Light up LED just after center

if (num >= 2){//LED 2 before center exists
analogWrite(ledPin[num-2],ledLow); //Light it up with ledLow

if (num <= nLed-3){//LED 2 after center exists
analogWrite(ledPin[num+2],ledLow); //Light it up with ledLow

void setup() {

void loop() {
int rest[] = {75,100,150,100,100,100,150,100,75}; //delay for each step
int ind = 0; //rest index

for (int i=-1; i <= nLed; i++){//Step through LEDs from low to high
ind++; }
for (int i=nLed; i >= -1 ; i--){//Step through LEDs from high to low

The wiring is very simple. Here’s the wiring diagram.
If you set that up and send the above code, the lights should do their Cylon thing.
Keep in mind that the Arduino needs a few moments (a little more than 10 seconds) to get going. So, the first LED (the one plugged into pin 13) will pulse for about that long before it starts working how we want it to. Be patient.
It may seem like a strange set of pins that I’m using and look like I could have used 12 instead of 7 LEDs. The pins I used are actually the Pulse Width Modulation (PWM) pins for the Arduino Micro. The PWM analog pins let you set varying brightness levels, which we need for the way I set this up.
You’ll want some fairly long wire leads between the LEDs and the Arduino, depending on the space you have available in your helmet, but the LEDs will need to be on the front of your head, and you’ll need space for the battery, switch, and the Arduino with breadboard and crap-ton of wires. While deciding where to place things, remember that the Arduino has a pulsing blue power light on it… so, unless you’re into that sort of thing, you may want to hide it from view.

Those are the basics of how to get it working. Below, I’ll give a couple of ideas about how I went about attaching it to my Helmet. This super ugly diagram will help:


The LEDs are attached to the forehead cover of the helmet liner by Velcro. I cut down one strip of Velcro that covered the entire width of the forehead piece (see diagram above), punched 7 eqally spaced holes and pushed the LEDs through from the buisness side of the Velcro as seen in the picture. 20180713_141452_HDR

In my helmet, there is a little bit of space above my head on the sides, so I crammed the arduino and the battery in those spaces. Time will tell if I regret that for the Arduino, because I do supply a little force to it with my head when I move around. It isn’t uncomfortable for me, but the Arduino probably doesn’t like it. Were I to start over, I might make the leads for the LEDs a bit longer and attach the battery and Arduino to the very back of the helmet.

The battery is Velcroed into place, with just a strip of velcro attached to the battery. Changing the battery will require putting velcro on a new battery. There are lots of 9V battery holders available for cheap but they add a little width, and I had limited space to work with. Depending on your placement, this might be an option worth considering. It is orange in the diagram, and you can see it in both of the following images.20180713_145902_HDR20180713_150248_HDR

The switch is just hanging free back there and I have to keep a hand on it when I put the helmet on. It’s not the ideal solution, but it works in a half-assed first try sort of way. It is the blurry green thing in the foreground of the most recent image.

A similar statement about care and thought given to the switch placement can be made about the Arduino. It’s just sort of in there, held in place by all the wires and the fact that, when my head is in place, there’s not much room for it to move around. You can see it in the following image.20180713_150242_HDR

Another thing worth mentioning is that, with this setup the red lights shine on the inside of the mask in front of my eyes. I can see through it fine, but it’s a little annoying. If I had a black sticky-back foam sheet, I’d probably cut some strips and stack a few just under the row of LEDs to block some light from coming at a downward angle into my field of view.

Thanks for reading. I’d love to see if anyone else tries something similar and hear about alternate designs!