0%

玩转免费主机

玩转免费主机

谷歌colab 可以有很多好玩的方法。这里收集记录了常见可以用的玩法。

QQ群:397745473

桌面环境脚本

1
2
3
4
chrome-remote-desktop: https://raw.githubusercontent.com/vsyour/rSPD/main/RDP.sh
chrome-remote-desktop + anydesk: https://raw.githubusercontent.com/vsyour/rSPD/main/RDP2.sh

vnc: https://raw.githubusercontent.com/vsyour/rSPD/main/RDP3.sh

GITHUB 搭建WIN主机

1
2
https://github.com/rifkiyulia/WINRDP2
参考视频: https://www.youtube.com/watch?v=PgUkt4l1P6E

在线IDE搭建linux主机

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
https://www.katacoda.com/courses/docker-orchestration/playground
https://www.katacoda.com/courses/ubuntu/playground


! wget https://raw.githubusercontent.com/vsyour/rSPD/main/RDP2.sh &> /dev/null
!chmod +x RDP2.sh
! ./RDP2.sh

# 需注册
每个实例最多免费用24小时
https://ide.goorm.io/
sudo apt update
sudo apt -y install vnc4server
sudo apt install xfce4 xfce4-goodies -y
vncpasswd
sudo vncserver -geometry 1366x768

免费linux

1
2
https://canary.giggl.app/auth
生成一个免费的浏览器 网速极快。看youtube可以达到100多M

免费在线手机

1
2
60 minutes for free.
https://cloud.geny.io/

免费WINDOWS

1
https://vps.apponfly.com/?autostart=true

GITHUB | SSH 连接到 GitHub Actions

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
参考文章:
https://www.vediotalk.com/archives/6704
https://www.codeography.com/
https://p3terx.com/archives/ssh-to-the-github-actions-virtual-server-environment.html

实际上 GitHub Ac­tions 本身是不允许直接连接进行交互式操作,但有好事的开发者竟然另辟蹊径通过安装 tmate 来实现了 SSH 连接,并且制作了相关的 ac­tion 。这使得我们可以非常容易连接到 Ac­tions 的虚拟环境中,相当于免费获得了 20 台 E5 2vCPU/​7G RAM/​90G SSD 配置的 VPS 。

github仓库地址:
https://github.com/csexton/mxschmitt/action-tmate
https://github.com/mxschmitt/action-tmate
https://github.com/vsyour/action-tmate

name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup tmate session
uses: mxschmitt/action-tmate@v1

github仓库地址:
https://github.com/csexton/debugger-action
https://github.com/vsyour/debugger-action

name: Ubuntu
on: [push]
jobs:
Ubuntu:
runs-on: ubuntu-latest
steps:
- name: Setup Debug Session
uses: csexton/debugger-action@master

fork上面两个仓库任意地址
点击fork到自己仓库的项目Actions创建工作流
设置一个新的工作流

cognitiveclass

1
2
3
4
5
6
7
8
9
10
需要GITHUB账号登陆
https://labs.cognitiveclass.ai/login?logout=true

! wget https://raw.githubusercontent.com/vsyour/rSPD/main/RDP3.sh &> /dev/null
! chmod +x RDP3.sh
! ./RDP3.sh

https://dashboard.ngrok.com/login
screen ./ngrok tcp 5901
https://www.realvnc.com/en/connect/download/viewer/

无限建GITHUB

1
2
3
1.无限模式 
2.谷歌搜 clipmails
https://clipmails.com/

https://github.com/vsyour/Colab-Hacks

直接映射端口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
打开并登陆账号: https://colab.research.google.com/
!pip install -q colabcode
from colabcode import ColabCode
ColabCode(port=10000, password='helloworldvscoDe')

# 防断
while True:pass


#ssh 服务
apt update -y
apt install openssh-server -y
/etc/init.d/ssh start

# 建用户
username="admin"
password='mLjQrrcQ1Wyph!8^'
sudo useradd -m $username &> /dev/null
sudo adduser $username sudo &> /dev/null
echo "$username:$password" | sudo chpasswd
sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd


# 建外连SSH
ngrok authtoken 1zXzotpUHHYgSQuozsAXEtKJy8g_83z4EV9JT71ReHa9NbzYa
ngrok tcp 22
1
2
3
4
5
6
7
8
9
参考: 
https://amitness.com/vscode-on-colab/
https://pyngrok.readthedocs.io/en/latest/

!pip install -qqq pyngrok

from pyngrok import ngrok
ssh_tunnel = ngrok.connect(22, "tcp")
print(ngrok.get_tunnels())

安装VSCODE

1
2
3
!pip install -q colabcode
from colabcode import ColabCode
ColabCode(port=10000, password='helloworldvscoDe')

防断

1
while True:pass

得到vscode在命令窗口中执行

1
2
3
4
5
6
7
8
9
10
11
12
sudo -i
source <(curl -sL https://git.io/Jqfs7)

#ssh 服务
apt install openssh-server
/etc/init.d/ssh start

# ngrok隧道穿透
https://dashboard.ngrok.com/auth
ngrok authtoken 网站中得到KEY
ngrok authtoken 096bb497d71a56c9072cb996dd3ba4cf3c394b7c6b8abe39b6f2fa808cad3cc1
ngrok tcp 22

Colab RDP

1
2
3
4
参考: https://github.com/PradyumnaKrishna/Colab-Hacks
可以正常登陆远程桌面
直接打开 https://colab.research.google.com/github/PradyumnaKrishna/Colab-Hacks/blob/master/Colab%20RDP/Colab%20RDP.ipynb
就可以操作了

谷歌colab

1
2
打开 https://colab.research.google.com/
source <(curl -sL https://git.io/Jqfs7)

Code Server

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
生成一个VSCODE服务器

下在这个测试过可以正常使用
最强薅羊毛 | 使用Vscode搭配colab使用
使用的colab链接:
https://colab.research.google.com/drive/13uaLexwJlxlkW6WQgNhDqW6eAZQDlv7q?usp=sharing
防断:
https://colab.research.google.com/github/iErics/gd-utils/blob/master/Colab_gd_utils.ipynb

# 安装桌面环境
username="admin"
password='mLjQrrcQ1Wyph!8^'
sudo useradd -m $username &> /dev/null
sudo adduser $username sudo &> /dev/null
echo "$username:$password" | sudo chpasswd
sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd

sudo apt-get update -y &> /dev/null
sudo DEBIAN_FRONTEND=noninteractive apt install --assume-yes xfce4 desktop-base xfce4-terminal
sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/xfce4-session" > /etc/chrome-remote-desktop-session'
sudo apt remove --assume-yes gnome-terminal
sudo apt install --assume-yes xscreensaver
sudo systemctl disable lightdm.service

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg --install google-chrome-stable_current_amd64.deb
sudo apt install --assume-yes --fix-broken
sudo apt install xrdp
sudo /etc/init.d/xrdp restart

#ssh 服务
apt install openssh-server
/etc/init.d/ssh start

# ngrok隧道穿透
https://dashboard.ngrok.com/auth
ngrok authtoken 网站中得到KEY
ngrok tcp 22

用 Bitvise SSH Client 连接SSH端口后再直接连RDP就可以了。特别方便



# cloudflared端口隧道
wget -O cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
chmod 755 ./cloudflared
./cloudflared tunnel --url http://127.0.0.1:3389

# dingtalk端口隧道
git clone https://github.com/open-dingtalk/pierced.git
./ding -config=./ding.cfg -subdomain=kfire 4444

# tcp穿透
./ding -config=./ding.cfg -proto=tcp 3389

防断

1
2
3
4
5
6
7
8
9
10
新建一个code执行 
while True:pass

以下代码是利的已经不可以使用了:
# 在console中放下代码:
function ConnectButton(){
console.log("Connect pushed");
document.querySelector("#connect").click()
}
setInterval(ConnectButton,60000);

QQ群:397745473

欢迎关注我的其它发布渠道