Skip to content

Instantly share code, notes, and snippets.

@cb109
Last active July 10, 2018 08:30
Show Gist options
  • Select an option

  • Save cb109/518b587bd56fb37ed7fa5572aaec08d4 to your computer and use it in GitHub Desktop.

Select an option

Save cb109/518b587bd56fb37ed7fa5572aaec08d4 to your computer and use it in GitHub Desktop.
Render ngrok URL as QR code in your terminal
#!/bin/bash
#
# Assuming you have a running ngrok session, this snippet fetches the
# https URL from ngrok's local API and renders it as a QR code in your
# terminal. You can then scan it with a mobile phone to quickly load
# that URL.
#
# Based on:
# https://github.com/stedolan/jq/issues/861
#
# Requirements:
# $ sudo apt-get install curl jq qrencode
#
qrencode -t UTF8 $(
curl --silent http://localhost:4040/api/tunnels |
jq '.tunnels[] | select(.proto == "https").public_url'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment