Skip to content

Instantly share code, notes, and snippets.

@iamjwc
Created May 16, 2011 20:59
Show Gist options
  • Select an option

  • Save iamjwc/975362 to your computer and use it in GitHub Desktop.

Select an option

Save iamjwc/975362 to your computer and use it in GitHub Desktop.

Revisions

  1. iamjwc revised this gist May 16, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion serve.sh
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,4 @@ echo $IP:$PORT | pbcopy
    echo Serving at $IP:$PORT

    # Start http server on port passed in
    python -m SimpleHTTPServer $1 &> /dev/null
    python -m SimpleHTTPServer $PORT &> /dev/null
  2. iamjwc created this gist May 16, 2011.
    16 changes: 16 additions & 0 deletions serve.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #!/usr/bin/env bash

    IP=`ifconfig | grep "inet " | grep -v "inet 127.0.0.1" | cut -f 2 -d " "`
    PORT=$1
    if [ -z "$1" ]
    then
    PORT=8000
    fi

    # Copy ip and port to pasteboard
    echo $IP:$PORT | pbcopy

    echo Serving at $IP:$PORT

    # Start http server on port passed in
    python -m SimpleHTTPServer $1 &> /dev/null