Created
September 26, 2016 14:37
-
-
Save muhummadPatel/4d4afc442b18cdc4e064ce06a8c2b201 to your computer and use it in GitHub Desktop.
Python script to upload current computers public IP address to a github gist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Finds your public ip and writes it to a github gist. Run this as a cronjob as often as you like | |
| # When you need to ssh in, just check the gist for the ip to use | |
| # requires simplegist: pip install simplegist | |
| from datetime import datetime | |
| from simplegist import Simplegist | |
| from urllib2 import urlopen | |
| gg = Simplegist(username='[github username]', api_token='[github api token]') | |
| current_time = str(datetime.now()) | |
| ip = urlopen('http://ipinfo.io/ip').read().strip() | |
| content = current_time + " " + ip | |
| gg.profile().edit(id='[gist id]', content=content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment