-
-
Save thomasgroch/fca8f441e35b7a785cd1b11796c7273e to your computer and use it in GitHub Desktop.
Pair-up script
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
| #!/bin/bash | |
| ############################# | |
| # ./pairup | |
| # tmux pairing setup script | |
| ############################# | |
| # Prerequisites: | |
| # tmux | |
| # ngrok | |
| # Before running this command, you'll need to add the public keys of the users you'd like to have connect to your session. | |
| # For convenience, github public keys are a great way to go. It can be accessed via https://api.github.com/users/$username/keys | |
| # | |
| # e.g. | |
| # ~/.ssh/authorized_keys --> | |
| # command="/usr/local/bin/tmux new-session -t pairing -s $@-session" ssh-rsa <key goes here> https://github.com/username | |
| tmux_user=${TMUX_USER:-$USER} | |
| ngrok_host=${NGROK_HOST:-0.tcp.ngrok.io} | |
| tmux new-session -d -s pairing "ngrok tcp --log /tmp/ngrok.log 22" | |
| tmux split-window | |
| sleep 1 | |
| ngrok_port=$(grep 'tcp://' /tmp/ngrok.log | tail -1 | awk -F':' '{ print $NF }') | |
| ssh_command="ssh -p $ngrok_port $tmux_user@$ngrok_host" | |
| tmux send-keys "$ssh_command" C-m | |
| tmux attach |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment