Skip to content

Instantly share code, notes, and snippets.

@EZLiang
Last active March 19, 2020 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EZLiang/a890f8961ce62e0c4ab444198c32b15b to your computer and use it in GitHub Desktop.
Save EZLiang/a890f8961ce62e0c4ab444198c32b15b to your computer and use it in GitHub Desktop.
Gist Runner Python 3 -- run gists on your computer
"""
Copyright (c) 19 March 2020 EZLiang
This is distributed under the absolutely free lisence (https://gist.github.com/EZLiang/65b9a273fe2790d9abe31baf4f7b9d42)
To run:
----
$ python gistrunner.py username/gist_hash filename
or whichever python version works for you:
- python
- python3
- py
- py -3
"""
import urllib.request, sys, subprocess
def main():
address = "https://gist.githubusercontent.com/{}/{}/raw/{}".format(*(sys.argv[1].split("/")), sys.argv[2])
page = urllib.request.urlopen(address)
f = open("tempgist.py", "w")
f.write(str(page.read(), "utf-8"))
f.close()
subprocess.call("tempgist.py", shell=True)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment