Last active
January 18, 2019 18:35
-
-
Save jcmfernandes/cb624baee8953f60e97a1167a5557dc8 to your computer and use it in GitHub Desktop.
This file contains 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
[Unit] | |
Description=Share local port(s) with ngrok | |
After=syslog.target network.target | |
[Service] | |
PrivateTmp=true | |
Type=simple | |
Restart=always | |
RestartSec=1min | |
StandardOutput=null | |
StandardError=null | |
ExecStart=/opt/ngrok/ngrok start --config /opt/ngrok/ngrok.yml --all | |
ExecStop=/usr/bin/killall ngrok | |
[Install] | |
WantedBy=multi-user.target | |
This file contains 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
authtoken: | |
region: eu | |
json_resolver_url: "" | |
dns_resolver_ips: [] | |
console_ui: false | |
log_level: info | |
log_format: logfmt | |
log: /opt/ngrok/ngrok.log | |
web_addr: localhost:4040 | |
update: false | |
tunnels: | |
ssh: | |
addr: 22 | |
proto: tcp |
This file contains 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
#!/bin/bash | |
# https://tinyurl.com/w-tunnels | |
GIST_FILENAME='w-tunnels.json' | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
cd $DIR | |
set -ex | |
TMPFILE=$(mktemp) | |
echo '$GIST_FILENAME_RUBY =' \'${GIST_FILENAME}\' >> $TMPFILE | |
cat <<-RUBY >> $TMPFILE | |
require 'open-uri' | |
require 'json' | |
tunnels = JSON.parse(open('http://localhost:4040/api/tunnels').read) | |
tunnels.merge!(updated_at: Time.now.utc.to_s) | |
IO.write(\$GIST_FILENAME_RUBY, JSON.pretty_generate(tunnels)) | |
RUBY | |
ruby ${TMPFILE} | |
rm ${TMPFILE} | |
git add -u | |
git commit --allow-empty-message -m '' | |
git checkout --orphan new-master master | |
git commit --allow-empty-message -m '' | |
git branch -M new-master master | |
git push -f | |
git gc |
This file contains 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
{ | |
"tunnels": [ | |
{ | |
"name": "ssh", | |
"uri": "/api/tunnels/ssh", | |
"public_url": "tcp://0.tcp.eu.ngrok.io:16858", | |
"proto": "tcp", | |
"config": { | |
"addr": "localhost:22", | |
"inspect": false | |
}, | |
"metrics": { | |
"conns": { | |
"count": 4, | |
"gauge": 0, | |
"rate1": 9.52852247585503e-196, | |
"rate5": 7.486761581971751e-42, | |
"rate15": 1.4551065405658382e-16, | |
"p50": 316628573733, | |
"p90": 600102170608, | |
"p95": 600102170608, | |
"p99": 600102170608 | |
}, | |
"http": { | |
"count": 0, | |
"rate1": 0, | |
"rate5": 0, | |
"rate15": 0, | |
"p50": 0, | |
"p90": 0, | |
"p95": 0, | |
"p99": 0 | |
} | |
} | |
} | |
], | |
"uri": "/api/tunnels", | |
"updated_at": "2019-01-18 18:35:01 UTC" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment