Skip to content

Instantly share code, notes, and snippets.

@yock
Last active June 21, 2016 17:20
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 yock/ea7946dfb1972662eea53bb8f6638878 to your computer and use it in GitHub Desktop.
Save yock/ea7946dfb1972662eea53bb8f6638878 to your computer and use it in GitHub Desktop.
function static_server() {
PORT=8080
lsof -i :$PORT > /dev/null
while (( $? == 0 )) {
PORT=$((PORT+1))
lsof -i :$PORT
}
nohup python -m SimpleHTTPServer $PORT &
SERVERPID=$!
open -Wn http://localhost:$PORT
kill $SERVERPID
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment