Skip to content

Instantly share code, notes, and snippets.

@jikkuatwork
jikkuatwork / expose.zsh
Created June 24, 2024 14:06
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}'
}