Created
February 25, 2013 18:18
-
-
Save marclundgren/5031988 to your computer and use it in GitHub Desktop.
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
function tunnel { | |
# Using localtunnel | |
# https://npmjs.org/package/localtunnel | |
# Usage: | |
# tunnel [port [subdomain]] | |
# tunnel 8080 bzog | |
local port=${1-"80"}; | |
if [ "$2" != "" ]; then | |
local subdomain="--subdomain $2"; | |
fi; | |
local echo_msg="\nTunneling port: $port\nOpenning browser...\n\nExit with Ctrl+C."; | |
if [ $OSTYPE == "msys" ]; then | |
sys_exe="start"; | |
elif [ $OSTYPE == "cygwin" ]; then | |
sys_exe="cygstart"; | |
else | |
sys_exe="open"; | |
fi; | |
local awk_cmd='{ system("'$sys_exe' "$4) }'; | |
lt -k ~/.ssh/id_rsa.pub --port $port $subdomain | awk "$awk_cmd" | echo -e $echo_msg; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment