Skip to content

Instantly share code, notes, and snippets.

@dawranliou
Created September 17, 2016 01:52
Show Gist options
  • Save dawranliou/363bf8d9631930b143f7cdc011da91f5 to your computer and use it in GitHub Desktop.
Save dawranliou/363bf8d9631930b143f7cdc011da91f5 to your computer and use it in GitHub Desktop.
The program to check the traffic for my way home
#!python
import webbrowser
import os
destination = os.environ.get('HOME_ADDR')
destination = '+'.join(destination.split())
origin = os.environ.get('OFFICE_ADDR')
origin = '+'.join(origin.split())
url = 'https://www.google.com/maps/dir/%s/%s' % (origin, destination)
webbrowser.open(url)
@dawranliou
Copy link
Author

Instruction

  1. Protect yourself by hiding the home/office address in your environment variables.
    1. export HOME_ADDR="your-home-address"
    2. export OFFICE_ADDR="your-office-address"
  2. chmod +x takemehome.py
  3. ./takemehome.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment