Skip to content

Instantly share code, notes, and snippets.

@jsakamoto
Last active December 28, 2015 02:29
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 jsakamoto/7428511 to your computer and use it in GitHub Desktop.
Save jsakamoto/7428511 to your computer and use it in GitHub Desktop.
import webbrowser
import SimpleHTTPServer
import thread
import time
import urllib
from zipfile import ZipFile
import os
tagname = "1.0"
zipname = "markdown-presenter-" + tagname + ".zip"
zippath = "./" + zipname
url = "https://github.com/jsakamoto/MarkdownPresenter/releases/download/v." + tagname + "/" + zipname
# download zip archive of Markdown Presenter.
urllib.urlretrieve(url, zippath)
# ectract the zip.
zfile = ZipFile(zippath)
zfile.extractall(".")
zfile.close()
# clean up zip.
os.remove(zippath)
# launch default web browser to open Markdown Presenter
# after one shot timer to wait for warming up HTTP daemon.
def launch():
time.sleep(1)
webbrowser.open("http://localhost:8000/presenter.html")
thread.start_new_thread(launch, ())
# start mini HTTP daemon.
SimpleHTTPServer.test()
> python -c "import urllib2;exec(urllib2.urlopen('http://goo.gl/qqgFFQ').read())"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment