Created
October 21, 2014 19:53
-
-
Save cmawhorter/f2a09bcf63c68b0cff10 to your computer and use it in GitHub Desktop.
Add alias to bash_profile to get a quick http server anywhere. Just type H to serve current directory.
This file contains 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
# http://stackoverflow.com/a/12269225/670023 | |
# Binds to localhost | |
alias H="echo 'Serving HTTP on 127.0.0.1 port 8000 ...'; python -c 'import BaseHTTPServer as bhs, SimpleHTTPServer as shs; bhs.HTTPServer((\"127.0.0.1\", 8000), shs.SimpleHTTPRequestHandler).serve_forever()'" |
nice! i don't know why i didn't consider this sooner.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a version with an optional port argument (defaulting to
8000
):