Skip to content

Instantly share code, notes, and snippets.

@pikpikcu
Last active April 21, 2024 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pikpikcu/b58197008e48fde2e148daf24381addb to your computer and use it in GitHub Desktop.
Save pikpikcu/b58197008e48fde2e148daf24381addb to your computer and use it in GitHub Desktop.
#!/bin/bash
wget -O ng.sh https://github.com/kmille36/Docker-Ubuntu-Desktop-NoMachine/raw/main/ngrok.sh > /dev/null 2>&1
chmod +x ng.sh
./ng.sh
function goto
{
label=$1
cd
cmd=$(sed -n "/^:[[:blank:]][[:blank:]]*${label}/{:a;n;p;ba};" $0 |
grep -v ':$')
eval "$cmd"
exit
}
: ngrok
clear
echo "Go to: https://dashboard.ngrok.com/get-started/your-authtoken"
read -p "Paste Ngrok Authtoken: " CRP
./ngrok config add-authtoken $CRP
clear
echo "Repo: https://github.com/kmille36/Docker-Ubuntu-Desktop-NoMachine"
echo "======================="
echo "choose ngrok region (for better connection)."
echo "======================="
echo "us - United States (Ohio)"
echo "eu - Europe (Frankfurt)"
echo "ap - Asia/Pacific (Singapore)"
echo "au - Australia (Sydney)"
echo "sa - South America (Sao Paulo)"
echo "jp - Japan (Tokyo)"
echo "in - India (Mumbai)"
read -p "choose ngrok region: " CRP
./ngrok tcp --region $CRP 4000 &>/dev/null &
sleep 1
if curl --silent --show-error http://127.0.0.1:4040/api/tunnels > /dev/null 2>&1; then echo OK; else echo "Ngrok Error! Please try again!" && sleep 1 && goto ngrok; fi
read -p "Enter username: " USER
read -s -p "Enter password: " PASSWORD
echo
docker run --rm -d --network host --privileged --name nomachine-mate -e PASSWORD=$PASSWORD -e USER=$USER --cap-add=SYS_PTRACE --shm-size=1g thuonghai2711/nomachine-ubuntu-desktop:mate
clear
echo "NoMachine: https://www.nomachine.com/download"
echo Done! NoMachine Information:
echo IP Address:
curl --silent --show-error http://127.0.0.1:4040/api/tunnels | sed -nE 's/.*public_url":"tcp:..([^"]*).*/\1/p'
echo User: $USER
echo Passwd: $PASSWORD
echo "VM can't connect? Restart Cloud Shell then Re-run script."
seq 1 99999999 | while read i; do echo -en "\r Running . $i s /99999999 s";sleep 0.1;echo -en "\r Running .. $i s /99999999 s";sleep 0.1;echo -en "\r Running ... $i s /99999999 s";sleep 0.1;echo -en "\r Running .... $i s /99999999 s";sleep 0.1;echo -en "\r Running ..... $i s /99999999 s";sleep 0.1;echo -en "\r Running . $i s /99999999 s";sleep 0.1;echo -en "\r Running .... $i s /99999999 s";sleep 0.1;echo -en "\r Running ... $i s /99999999 s";sleep 0.1;echo -en "\r Running .. $i s /99999999 s";sleep 0.1;echo -en "\r Running . $i s /99999999 s";sleep 0.1; done
@pikpikcu
Copy link
Author

pikpikcu commented Apr 21, 2024

Setup VPS gcloud

  1. Open https://shell.cloud.google.com/
  2. paste this command in gcloud curl -sLkO https://gist.github.com/pikpikcu/b58197008e48fde2e148daf24381addb/raw/ea5184f0fc020fee07e705015a0ef42d1bf4acd5/vps-gc.sh ; bash vps-gc.sh
  3. Register an account https://ngrok.com/
  4. Get Token ngrok, Copy the token and paste it into Cloud Shell
  5. Select AP (recomended) or another country
  6. Downloads https://www.nomachine.com/download and login

@pikpikcu
Copy link
Author

Screenshot_20240421_161456

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment