Skip to content

Instantly share code, notes, and snippets.

@scottrogowski
Created March 26, 2015 16:04
Show Gist options
  • Save scottrogowski/80c9a3d855431e2241f5 to your computer and use it in GitHub Desktop.
Save scottrogowski/80c9a3d855431e2241f5 to your computer and use it in GitHub Desktop.
Share the files in the folder over the network printing the ip address they can be found at
#!/bin/bash
ip=`ifconfig -r en0 inet | sed -E '/en0/d;s/inet[ \t]([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).+/\1/'`
ip=`echo $ip | tr -d '[:space:]'`
echo "The files in this directory are being served! Go to $ip:8000 in a browser on your local network. When you are done, use ctrl-c to exit"
python -m SimpleHTTPServer 8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment