 Hello again friends, and welcome to another evening edition of the astrophlog Tomorrow will be two weeks for us here in Self-isolation I think considering two young children and all the panic in the world. It's gone quite well I'm really happy to report that all four of us appear really healthy We've gone for some long walks in our neighborhood, which is pretty quiet And I think the actual highlight of this time so far has been how excited my three-year-old has been about the free little Libraries if you haven't seen these before they're amazing you put them up in your front yard And people can just come by and take books or leave books We found six of these things so far within 20 or 30 minute walk of our house tonight on the astrophlog I'm just gonna tell you a short story over six years ago at the end of 2013 I created a Twitter bot called mock twain And it was a really good way to learn a bit of Python programming and how to interact with things on the web The actual coding of the Twitter robot was only maybe a day or two of effort There were lots of examples on the internet of how to build these Python based Twitter robots What really took a while was designing what the bot should do now a Twitter robot can do anything It can tell you about the weather it could interact with you it could answer questions in my case I wanted my Twitter bot to read an entire book. I thought Mark Twain was a good subject matter since his writing is kind of funny It's very American I was really interested in mixing these mediums of taking the experience of reading a book and Putting that into the short form content of Twitter And so mock twain was born to tweet an entire book over the course of a year why a year I don't know a year is a good time scale to do things But I think the project really found its niche when my friend Jake Vanderblas came back from a conference and gave me a Piece of the free swag that he had a raspberry pie. This is a tiny computer So I wrote my little Python code and I set this little machine off to run for a year But I thought about where am I going to put this little computer that it's gonna be safe and stable for an entire year It came with a little plastic case and it could just sit on my desk for a year But that somehow didn't seem quite fitting for Mark Twain or certainly not from Mock Twain And so I took a little trip to the bookstore and I picked up this copy of The Mississippi writings which included the book that I was going to tweet which was the adventures of Tom Sawyer The plastic case was not good enough. This would be our vehicle The project I think was a huge success within a week or so It had almost five or six hundred followers people seem to be enjoying the idea at least But I quickly learned a few lessons number one a Book is not a good case for a computer even a tiny little computer like the raspberry pie Well, this is a pretty low power operation It does produce heat and this book got hot hot enough In fact the poor raspberry pie shut down after about four days So the book had to sit open to let it breathe the second take away and maybe this was obvious from the beginning This is not a good way to read a book. I don't think it's a matter of reading the book too slowly I think it's the fact that Twitter is so ephemeral that if you don't catch the messages when they happen You might miss days worth of the story and before you know it It's on to another chapter and you have no idea what's going on But I will say some tweets generated lots of interaction Sometimes there are funny lines or memorable moments and those will get a lot of engagement now after its year of tweeting 10 times a day with a few power outages and overheating Mock Twain completed its journey and read the entirety of The Adventures of Tom Sawyer and the project is over the bot was shelved And I haven't really done anything with it in the last six years But the experience of building a Twitter bot was really instructive for when I wanted to spin up a new Twitter bot called Apollo 11 mission which tweeted out in nearly real time the entire mission logs of the Apollo 11 mission using the code from Mock Twain and a little bit of work getting the logs into the right format I was able to get this bot booted up and running in like a day instead of tweeting with a regular schedule over a year This bot had to tweet based on the timestamp of every entry of the mission log So there'd be long stints where nothing was happening because the astronauts slept and then there'd be very high activity when they were Radioing back and forth say during during key moments of the mission and it was here that I learned some more valuable lessons in terms of building Twitter bots You need to really understand the limitations of the Twitter program interface Specifically the limitations on how often you can tweet during the landing the actual descent of the lunar module Onto the surface of the moon all three astronauts are talking constantly to mission control and mission control back to them There's messages going on every few seconds and a lot of them are exactly the same like the astronauts just saying okay, Roger Okay, and right as the astronauts were about to touch down something like a hundred feet from the surface really rapid cadence of very short Very similar messages caused Twitter to think that my bot had turned into a spam robot and put it in Twitter timeout for about four hours So it should have been the highlight of the entire project the eagle has landed turned out to be massively embarrassing Frustrating so some rapid changes were made. I was able to group some messages together Make some small changes so that messages didn't seem exactly the same as they came out in rapid fire And when the next milestone for the mission the actual walk on the surface, that's one small step for man The bot did not crash and we managed to get that if you're interested in building these kinds of bots There's a ton of resources on the web I'll try to put a couple of links down in the description below And there's actually a really phenomenal textbook called Twitter bots by Tony veal and Mike cook I've read it. It's really good And I've actually used the textbook as a outline for a course that I'd like to teach on how to build Twitter bots So there you go friends a little late night story time I hope that you're all doing well that you're staying safe You're staying inside and away from other people and that I see many of you soon