Skip to content

Instantly share code, notes, and snippets.

@tsavo-at-pieces
Last active April 20, 2026 13:29
Show Gist options
  • Select an option

  • Save tsavo-at-pieces/8050bb1a3b7d8c0dca56f5f6a631b4b4 to your computer and use it in GitHub Desktop.

Select an option

Save tsavo-at-pieces/8050bb1a3b7d8c0dca56f5f6a631b4b4 to your computer and use it in GitHub Desktop.
Tunnel Windows
# setup_ngrok_proxy.ps1
$ErrorActionPreference = "Stop"
# Prompt for tunnel name
$Name = Read-Host "Enter your tunnel name (for {name}.tunnel.pieces.stream)"
if ([string]::IsNullOrWhiteSpace($Name)) {
Write-Error "Tunnel name cannot be empty"
exit 1
}
# Install ngrok if not already installed
if (-not (Get-Command ngrok -ErrorAction SilentlyContinue)) {
Write-Host "Installing ngrok..."
if (Get-Command winget -ErrorAction SilentlyContinue) {
winget install --id Ngrok.Ngrok -e --accept-source-agreements --accept-package-agreements
}
elseif (Get-Command choco -ErrorAction SilentlyContinue) {
choco install ngrok -y
}
else {
Write-Host "Neither winget nor Chocolatey found. Installing Chocolatey first..."
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install ngrok -y
}
# Refresh PATH so ngrok is available in this session
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
} else {
Write-Host "ngrok already installed, skipping."
}
# Configure auth token
Write-Host "Configuring ngrok auth token..."
ngrok config add-authtoken 33WC7lfUq9XrJvCKGgGOWCw2U1O_6AeA4LbEgdzB75PcdbEk3
# Start the tunnel
Write-Host "Starting tunnel at $Name.tunnel.pieces.stream -> localhost:39300"
ngrok http 39300 --domain "$Name.tunnel.pieces.stream"
@tsavo-at-pieces

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment