New Job


And, in honor of the new gig, here's a very old public domain picture of the White House from Theodore Roosevelt's Programme of Exercises and Illustrated Inaugural History, 1905. 


  

Label Emails Awaiting Response

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:

  1. Create a new Google Script (go to https://script.google.com/ and choose "Blank Project" and while logged into your Google account)
  2. Replace the template code in the blank project with the Awaiting Response code at https://raw.githubusercontent.com/amac0/miscpubliccode/master/awaitingresponse.js
  3. 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.
  4. Save the script by choosing "File|Save" from the Google Script menu.
  5. 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).
  6. If desired, set the script to run every day by choosing "Resources|Current project's triggers" from the Google Script menu.
The script itself is:
Thank you again to @hijonathan.

Quick & Dirty For Setting Up Using Twitter in Python

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.

  1. Install twython with:
    sudo pip install twython
  2. Register the application on Twitter
    1. go to https://dev.twitter.com/apps
    2. fill out the form and hit "Create your Twitter application"
  3. 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.
  4. Go get your API Keys
    1. Click on the "API Keys" tab from the Application Detail page
    2. Copy the API key
  5. In a terminal window:
    1. fire up the python interpreter
    2. import the modules you need:
      from twython import Twython, TwythonError
    3. make a variable for your API key:
      APP_KEY = 
      and have it equal the thing you copied from the Twitter site using single quotation marks around it.
  6. Switch back to the Twitter API Key browser page:
    1. Copy the API Secret key
  7. Switch back to terminal running the python interpreter:
    1. 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. 
    2. use twython to get a object by entering the following in the python interpreter:
      twitter
      = Twython(APP_KEY, APP_SECRET)
    3. then an auth object:
      auth = twitter.get_authentication_tokens()
  8. Still in the python interpreter, grab the oauth url copying the URL you see when you type:
    auth['auth_url']
  9. 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
    PIN = 
    1. create a variable with the AUTH TOKEN
      AUTH_TOKEN=auth['oauth_token']
    2. create a variable with the AUTH SECRET
      AUTH_SECRET=auth['oauth_token_secret']
  10. 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)
  11. 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
  12. 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)

    try:
        twitter.update_status(status='Just a test, please ignore')
    except TwythonError as e:

        print e
     

PS I now use Tweepy instead of Twython but all of this is similar there.

Banking Advertising



William Borsody, Financial Advertising, 1909

LAMAS Architecture

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.

Google Ngram Viewer Now In "Define"

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:


Google is drawing on mentions of these words in the corpus of books it has scanned as part of the Google Books project, which I had the privilege of working on while at Google. Indeed this is really just a more visible way of exposing the phenomenal Ngram viewer that Google has improved over the last few years. The Ngram viewer can be used to compare word frequencies and do lots of other interesting stuff. The database of word frequencies over time is also available to the public under the Creative Commons Attribution 3.0 Unported License so that others can build on the data. Here is a view of Twitter versus Tweet in the Ngram Viewer:



Anyhow, this may not be new to the world but it was new to me and is way cool. As the Google Books legal cases continue, it is also another great example of the value of the initiative to the public. 

PS Two more I couldn't resist adding. Good luck not spending the next half hour doing your own.



Update: And yes, there are many flaws with relying on the Ngram data to prove a point without further analysis. For examples, see Robusto's discussion on StackExchange. 




Some News and Thanks

I will soon pass the Twitter General Counsel torch to Vijaya Gadde (@vijaya). Vijaya has been managing Twitter’s corporate and international legal work, and I’ve gotten to know her well over the last fourteen years. I couldn’t be happier with her appointment as General Counsel of Twitter.


As we transition, I will dial back my day to day involvement with Twitter. I’ll continue to support the company and its great people by staying on as an advisor for the legal, trust & safety, corporate development and public policy teams. I continue to care deeply about Twitter, the folks who work at Twitter and our tremendous users, so I’ll remain close to all three.


It has been a joy to work at Twitter. I have been fortunate to support the multiple award winning trust, public policy, corporate development, legal and, at various times during my tenure, communications and trust engineering teams. These are phenomenal teams made up of great people. I also continue to be awestruck by the many, varied, incredible ways people use Twitter.


I am proud to have worked with colleagues who defend and respect the user’s voice; who push freedom of expression and transparency; and who innovate and lead. Together we’ve brought some incredible products and talent into Twitter. We’ve supported teams creating new businesses and pushing to reach every person on the planet. Twitter continues to employ some of the funniest, most generous, smart, passionate and humble people I’ve ever met. I was lucky to get to work with them, and you can too.


To my teams, all the folks who work at Twitter and Twitter users: Thank you. I can’t wait to see what you do together next.


As for me, it has been my privilege to work and fight on behalf of great companies and their users over the last decade. A privilege and a lot of work. So, I’m looking forward to engaging my various internet passions from new and different perspectives, seeing friends and family without distraction, and just goofing off a bit. We should all do more of that.


More to come here and at @amac.

Public Domain Images courtesy of Google Books, sourcing here and here.

Pericrocotus


A beautiful bird I had never heard of, the Pericrocotus. From The Illustrated Natural History: Birds, p. 368.