Skip to content

Instantly share code, notes, and snippets.

@cloudnull
Last active September 6, 2022 17:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cloudnull/d9dac6e38222d8a6d2e01f87ae28c99b to your computer and use it in GitHub Desktop.
Save cloudnull/d9dac6e38222d8a6d2e01f87ae28c99b 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