Skip to content

Instantly share code, notes, and snippets.

@jrialland
Created March 11, 2016 10:14
Show Gist options
  • Save jrialland/38110b1d59c94b8e1b4a to your computer and use it in GitHub Desktop.
Save jrialland/38110b1d59c94b8e1b4a to your computer and use it in GitHub Desktop.
bash -> gets a random free tcp port to bind
FREE_TCP_PORT=`python -c "from socket import*;s=socket(AF_INET,SOCK_STREAM);s.bind(('',0));s.listen(1);print s.getsockname()[1];s.close()"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment