Last active
April 20, 2026 13:29
-
-
Save tsavo-at-pieces/8050bb1a3b7d8c0dca56f5f6a631b4b4 to your computer and use it in GitHub Desktop.
Tunnel Windows
This file contains hidden or 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
| # 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" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
iex (iwr -UseBasicParsing "https://gist.github.com/tsavo-at-pieces/8050bb1a3b7d8c0dca56f5f6a631b4b4/raw/setup_ngrok_proxy.ps1").Content