Skip to content

Instantly share code, notes, and snippets.

@jikkuatwork
Created June 24, 2024 14:06
Show Gist options
  • Save jikkuatwork/bd27a8725f928134db5e216453f567b8 to your computer and use it in GitHub Desktop.
Save jikkuatwork/bd27a8725f928134db5e216453f567b8 to your computer and use it in GitHub Desktop.
Expose local ports to Internet
function expose() {
if [[ -z "$1" ]]; then
echo "Error: No port specified."
return 1 # Exit the function with an error status
fi
local port=$1
ssh -R 80:localhost:${port} [email protected] 2>&1 | awk '/https:\/\/[a-zA-Z0-9]+\.lhr\.life/ {print $NF; fflush(); exit}'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment