I hate pulling out my phone every time I need that stupid 6 digit code to login to Gmail/GitHub/Dropbox/AWS and any other site that supports 2 factor. I like the added security, I just hate reaching for my phone 30 times a day. In an effort t simplify my workflow, I threw this quick python script together to generate the code for me:

#!/usr/bin/env python
import pyotp
totp = pyotp.TOTP('YourReallyLongToken')
print totp.now()

You'll probably need to install pyotp with pip.

From there, I created a simple Alfred Workflow to paste it for me when I need it: