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 [ ]
Recently got to hang out with my brother, James Macgillivray, and catch up on his and his wife's architecture firm, LAMAS. Really cool stuff he and Wei-han Vivian Lee are up too. Plus the LAMAS (Lee and Macgillivray Architecture Studio) site is cool as well and showcases a bunch of their work. Amazing to see what they have already built and looking forward to seeing what they will build in the future.
Posted by macgill on 10/23/2013 [ ]
I've always found Google's definitions to be useful but yesterday I noticed they had added something useful from Google Books to their definitions: understanding a word's usage over time.
For example, a search for "define Twitter" yields:
If you expand the definition by clicking on the big downward arrow, you see a bunch of additional information including this chart of the uses of "Twitter" over time: