Guest post by my son below.
Guest post by my son below.
Always great when you discover a friends and family doing cool stuff online. Mike is my older cousin and someone I've looked up to from when I was little and still do today.
Yesterday I stumbled on his blog. He also has a Twitter handle.
Check them both out:
Mike Minnes's blog called Path Forward
Mike Minnes on Twitter
Posted by Alexander Macgillivray on 6/02/2016 [ ]
Finally got around to finishing a script that will take a Twitter Archive and turn it into a set of images suitable for printing as a photo book. This takes a tweet like this one:
Beautiful day for a walk. pic.twitter.com/iqhDVThfcI— Alex Macgillivray (@amac) January 30, 2016
and turns it into an image like this one:
would become an image like this one:
I wrote it for tweets that have single images with no other links. It works best if the account doesn't have a lot of RTs, @replies or links as those don't really translate well to a photo book.
If the script gets a tweet with no image, it will represent the text as an image. So a tweet like this one:
Anyone have experience with small format, square photo books? I like the @BlurbBooks interface but 7x7" is probably too big for my project.— Alex Macgillivray (@amac) January 2, 2016
looks like this:
Thank you to @Dr.Drang, who wrote Completing my Twitter Archive which is a helpful post and I used some of his code.
The TwitterBookImages script is:
Jake was a big part of the strength of our team and we will miss him dearly. I will miss his smile, attitude, and presence. I am also sad that I won’t get to see his next set of wonderful things come to pass in the world. But I am thankful to have known and worked with him. I am thankful he was part of our community and for the dents he made in the universe.
I have been horrible at responding to personal email while taking time off. Rather than declare bankruptcy or write a pithy autoresponder, I was spurred by an acquaintance to figure out a way to mark threads in Gmail that may be awaiting a response from me. As a result, I got to learn about Google Scripts, finally sign up for my own Github account and virtually meet @hijonathan.
Jonathan Kim had the opposite problem from me. He sent a bunch of emails that he wanted to be reminded of when the recipient had not responded. He wrote a great script and published how to install it. I made some very slight modifications to his script to do the opposite (see below).
The AwaitingResponse.js script will look through your inbox for threads messages to you that are between 5 and 14 days old but that you have not responded to. It will label those messages “AR” and you can then use a search like this one to diligently respond to those messages. It is easy to customize the script to search a different label, such as just messages Gmail has categorized as “priority,” or for a different period of time.
To install and customize, follow these steps:
- Create a new Google Script (go to https://script.google.com/ and choose "Blank Project" and while logged into your Google account)
- Replace the template code in the blank project with the Awaiting Response code at https://raw.githubusercontent.com/amac0/miscpubliccode/master/awaitingresponse.js
- If desired, change the label to look in, the text for the label where messages will be placed and the age range to search. These are all at the top of the script and the comments will help you decide what to change.
- Save the script by choosing "File|Save" from the Google Script menu.
- Run the script by choosing "Run|main" from the Google Script menu. Go look at your inbox and make sure it worked (it may take a while).
- If desired, set the script to run every day by choosing "Resources|Current project's triggers" from the Google Script menu.
Let's say you want to post to your Twitter account from a command-line python script. Here are the quick a dirty steps to get up and running with twython. There is another description at the twython site but it isn't as basic as this.
- Install twython with:
sudo pip install twython
- Register the application on Twitter
- go to https://dev.twitter.com/apps
- fill out the form and hit "Create your Twitter application"
- From the App "Details" tab, click "modify app permissions" and change to "Read and Write" (it'll take a few minutes for that to be reflected on the app details page.
- Go get your API Keys
- Click on the "API Keys" tab from the Application Detail page
- Copy the API key
- In a terminal window:
- fire up the python interpreter
- import the modules you need:
from twython import Twython, TwythonError
- make a variable for your API key:
and have it equal the thing you copied from the Twitter site using single quotation marks around it.
- Switch back to the Twitter API Key browser page:
- Copy the API Secret key
- Switch back to terminal running the python interpreter:
- make a variable for your API secret:
APP_SECRET = and have it equal the thing you copied from the Twitter site using single quotation marks around it.
- use twython to get a object by entering the following in the python interpreter:
twitter = Twython(APP_KEY, APP_SECRET)
- then an auth object:
auth = twitter.get_authentication_tokens()
- Still in the python interpreter, grab the oauth url copying the URL you see when you type:
- Past the URL into a browser, sign into your account on Twitter if prompted and click "Authorize App." You should get a code, copy that code into your python interpreter window as a variable for the PIN
- create a variable with the AUTH TOKEN
- create a variable with the AUTH SECRET
- Then, in the interpreter, reconnect to Twitter and get the final authorization tokens with the PIN number that you set earlier:
twitter = Twython(APP_KEY, APP_SECRET, auth['oauth_token'], auth['oauth_token_secret'])
final_step = twitter.get_authorized_tokens(PIN)
- then look at final_step['oauth_token'] and final_step['oauth_token_secret'] and save them somewhere in the configuration of your app. Also be sure to copy the original APP Key and APP Secret to a variable in your app. Below I use APP_KEY, APP_SECRET, OAUTH_TOKEN and OAUTH_TOKEN_SECRET
- Once you are all done you can use this code in an app to test it:
from twython import Twython, TwythonError
APP_KEY = [the thing you copied from earlier in single quotes]
APP_SECRET = [the thing you copied from earlier in single quotes]
OAUTH_TOKEN = [the thing you copied from earlier in single quotes]
OAUTH_TOKEN_SECRET = [the thing you copied from earlier in single quotes]
# Requires Authentication as of Twitter API v1.1
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
twitter.update_status(status='Just a test, please ignore')
except TwythonError as e:
PS I now use Tweepy instead of Twython but all of this is similar there.
Posted by Alexander Macgillivray on 4/13/2014 [ ]