Created
April 24, 2016 22:55
-
-
Save pamo/3fa72c8c61d5baa732c672253790bd67 to your computer and use it in GitHub Desktop.
bash server function
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
server () | |
{ | |
local port="${1:-8000}"; | |
sleep 1 && open "http://localhost:${port}/" & python -c 'import SimpleHTTPServer; | |
map = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map; | |
map[""] = "text/plain"; | |
for key, value in map.items(): | |
map[key] = value + ";charset=UTF-8"; | |
SimpleHTTPServer.test();' "$port" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment