Ever since seeing this Microprinter post I’ve been fascinated by the idea of having a thermal receipt printer to play with. But they were always a bit too pricey for a toy, and I wasn’t sure that even if I got one I’d be able to make it work.
Then I discovered the Printer project over at Go Free Range. James Adam had already done most of the work for me. He’s got detailed instructions on how to put this together with a cheap thermal printer from Adafruit, an Arduino with an ethernet shield, and a few LED’s, resistors, and wires.
What I’ve done is written a python script that takes a folder full of text files, converts them to HTML via Markdown, and then sends them to one of these free range printers. Here it is in action:
Here’s the script. It includes the Markdown python library and all the other libraries are standard, so you shouldn’t need to track down any dependencies. You’ll just need to update the variables in the printtxt.py script to point to your folders and your printer URL.
I’ve pointed the script at a folder in my Dropbox, which means that I can save these text files from anywhere and have them print out automatically. I’m also using Hazel on a Mac Mini to automate running the script as soon as a new file arrives in the To Print folder, but you could just as easily run the script via chron or the Windows Schedule Task program.
What will I use this for? I don’t know yet. But I think it’s pretty neat.
I wrote a little python script to help people get motivated to write more*. It compares the word count of a text file (by default “mywork.txt”) to a target number; if you’ve exceeded your target, it will congratulate you and download a recent picture of a kitten from flickr.
I wrote this over a couple hours, so it’s mostly rough edges. It depends on having wc and wget installed (which you already do if you have linux). I know it works on Python 2.7.2, but it should work on anything > Python 2.5.
Installation instructions:
1. Install the Python flickrapi module (on Ubuntu, sudo apt-get install python-flickrapi)
2. Download and extract this motivator script zip file.
3. Get a Flickr API key; it’s super easy, just sign into flickr and fill out a 2 line form.
3. Edit the .motivator file with your target # of words and with your Flickr API key. (Can’t find .motivator? try pushing ctrl-h to show hidden files if you’re using Ubuntu.)
4. Write more words into mywork.txt than your target number of words.
5. From the command line, go to the motivator folder and run “python motivator.py”
6. Collect your kitten photograph from the rewards folder.
Don’t like kittens (you monster)? You can change the rewardtag variable in .motivator to whatever flickr tag you like.
Enjoy!
* Actually, it was more to play with Python for an evening. I will probably never touch this again, but it was fun and, who knows, maybe someone will get something out of it.
I don’t like how my blog now consists of a bunch of links. I’m turning off the automatic post machine and I have replaced it with a neat widget on my home page that lists my latest bookmarks on Pinboard.
Sounds like a good book! « Zompist’s E-Z rant page – An interesting point: It would have been difficult to steal stuff from your neighbors before the industrial revolution because everything was custom made.
bmatzelle/gow – GitHub – An easy and clean way of adding a bunch of GNU/Linux tools to Windows (stuff like grep and wget another good stuff, complete list here.