Last active
September 6, 2022 17:47
-
-
Save cloudnull/d9dac6e38222d8a6d2e01f87ae28c99b to your computer and use it in GitHub Desktop.
Install the latest static tmate and start a session
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
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