Skip to content

Instantly share code, notes, and snippets.

@carlsmith carlsmith/fileserver.py
Last active Jan 19, 2017

Embed
What would you like to do?
IPython line magic for launching a static fileserver. It uses Ruby as the Python fileserver sucks a bit.
import os
from IPython.core.magic import register_line_magic as line_magic
@line_magic
def fileserver(args):
path, port = args.split(" ") if args else (".", "8080")
os.system('ruby -run -ehttpd "{}" -p{}'.format(path, port))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.