Skip to content

Instantly share code, notes, and snippets.

@jjasghar
Forked from cloudnull/install-n-start-tmate.sh
Created January 8, 2022 00:14
Show Gist options
  • Save jjasghar/f60812d003c2567eeb024d92dd5c989a to your computer and use it in GitHub Desktop.
Save jjasghar/f60812d003c2567eeb024d92dd5c989a to your computer and use it in GitHub Desktop.
Install the latest static tmate and start a session
TMATE_FILE=$($(command -v python3 || command -v python) <<EOC
import requests
r = requests.get(
'https://api.github.com/repos/tmate-io/tmate/releases/latest'
)
releases = r.json()
amd64_releases = [
i for i in releases['assets']
if 'amd64' in i['name'] and not 'dbg' in i['name']
][0]
r = requests.get(amd64_releases['browser_download_url'], allow_redirects=True)
with open(amd64_releases['name'], 'wb') as f:
f.write(r.content)
print(amd64_releases['name'])
EOC
)
tar xf ${TMATE_FILE}
sudo cp $(basename -s '.tar.xz' ${TMATE_FILE})/tmate /usr/local/bin/
echo "tmate-io has been installed. To use tmate, execute the tmate command normally."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment