Last active
December 26, 2015 02:19
-
-
Save cowlicks/7077935 to your computer and use it in GitHub Desktop.
Revisions
-
cowlicks revised this gist
Oct 21, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ #!/usr/bin/env python """A script to generate and serve the slides from a ipython notebook that auto updates the slides. It would be nice to include something like this in IPython. Usage: >>> python serve_slides.py presentation.ipynb -
cowlicks revised this gist
Oct 21, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import pyinotify infile = sys.argv[1] # It would be better to use IPython's API but... serve = 'ipython nbconvert --to slides --post serve ' + infile export = 'ipython nbconvert --to slides ' + infile @@ -25,7 +25,7 @@ def onChange(ev): notifier = pyinotify.Notifier(wm) # generate and serve the slides. serve = subprocess.Popen(serve.split(' ')) while True: try: -
cowlicks created this gist
Oct 21, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ #!/usr/bin/env python """A script to generate and serve the slides from a ipython notebook that auto updates the slides. Usage: >>> python serve_slides.py presentation.ipynb """ import sys import subprocess import pyinotify infile = sys.argv[1] # A hack because nbconvert lacks documentation. serve = 'ipython nbconvert --to slides --post serve ' + infile export = 'ipython nbconvert --to slides ' + infile def onChange(ev): """Regenerate slides from the notebook.""" subprocess.call(export.split(' ')) # Setup pyinotify to watch the notebook. wm = pyinotify.WatchManager() wm.add_watch(infile, pyinotify.IN_MODIFY, onChange) notifier = pyinotify.Notifier(wm) # generate and serve the slides. serve = subprocess.Popen(serve.split(" ")) while True: try: # Start watching the notebook for changes. notifier.loop() except KeyboardInterrupt: # Clean up serve.kill() notifier.stop() break