Upload 2 files
Browse files- get_ip.py +26 -0
- zrok_sign_up.ipynb +58 -0
get_ip.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
import requests
|
3 |
+
from colorama import init, Fore, Back, Style
|
4 |
+
from colablib.colored_print import cprint, print_line
|
5 |
+
import time
|
6 |
+
import cloudpickle as pickle
|
7 |
+
try:
|
8 |
+
start_colab
|
9 |
+
except:
|
10 |
+
start_colab = int(time.time())-5
|
11 |
+
|
12 |
+
def get_public_ip(version='ipv4'):
|
13 |
+
try:
|
14 |
+
url = f'https://api64.ipify.org?format=json&{version}=true'
|
15 |
+
response = requests.get(url)
|
16 |
+
data = response.json()
|
17 |
+
public_ip = data['ip']
|
18 |
+
return public_ip
|
19 |
+
except Exception as e:
|
20 |
+
print(f"Error getting public {version} address:", e)
|
21 |
+
|
22 |
+
public_ipv4 = get_public_ip(version='ipv4')
|
23 |
+
|
24 |
+
tunnel_class = pickle.load(open("new_tunnel", "rb"), encoding="utf-8")
|
25 |
+
tunnel_port= 1101
|
26 |
+
tunnel = tunnel_class(tunnel_port)
|
zrok_sign_up.ipynb
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"nbformat": 4,
|
3 |
+
"nbformat_minor": 0,
|
4 |
+
"metadata": {
|
5 |
+
"colab": {
|
6 |
+
"private_outputs": true,
|
7 |
+
"provenance": []
|
8 |
+
},
|
9 |
+
"kernelspec": {
|
10 |
+
"name": "python3",
|
11 |
+
"display_name": "Python 3"
|
12 |
+
},
|
13 |
+
"language_info": {
|
14 |
+
"name": "python"
|
15 |
+
}
|
16 |
+
},
|
17 |
+
"cells": [
|
18 |
+
{
|
19 |
+
"cell_type": "markdown",
|
20 |
+
"source": [
|
21 |
+
" [![](https://img.shields.io/static/v1?message=Open%20in%20Colab&logo=googlecolab&labelColor=5c5c5c&color=0f80c1&label=%20&style=for-the-badge)](https://colab.research.google.com/github/DEX-1101/sd-webui-notebook/blob/main/zrok_sign_up.ipynb)"
|
22 |
+
],
|
23 |
+
"metadata": {
|
24 |
+
"id": "RTurZjG73A7D"
|
25 |
+
}
|
26 |
+
},
|
27 |
+
{
|
28 |
+
"cell_type": "code",
|
29 |
+
"execution_count": null,
|
30 |
+
"metadata": {
|
31 |
+
"cellView": "form",
|
32 |
+
"id": "_Pe73QvVseK2"
|
33 |
+
},
|
34 |
+
"outputs": [],
|
35 |
+
"source": [
|
36 |
+
"# @title chris perry asu\n",
|
37 |
+
"# @markdown Run this cell to install zork and open up a terminal for sing up.\n",
|
38 |
+
"# @markdown - After the terminal appear, type `zrok invite` and press `Enter`.\n",
|
39 |
+
"# @markdown - Fill your email, and press submit, use `Tab` to navigate.\n",
|
40 |
+
"# @markdown - Open up your email and they will send your an email about registration link.\n",
|
41 |
+
"# @markdown - Just follow the instruction. Should be easy. right...\n",
|
42 |
+
"# @markdown - In the end you will get `zrok enable <your_token>`.\n",
|
43 |
+
"# @markdown - Back to you notebook and paste the `token` there and GG.\n",
|
44 |
+
"\n",
|
45 |
+
"from IPython.display import clear_output\n",
|
46 |
+
"!pip install colab-xterm\n",
|
47 |
+
"%load_ext colabxterm\n",
|
48 |
+
"\n",
|
49 |
+
"%cd /usr/bin\n",
|
50 |
+
"!curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz\n",
|
51 |
+
"!tar -xzf zrok_0.4.23_linux_amd64.tar.gz && rm -rf zrok_0.4.23_linux_amd64.tar.gz\n",
|
52 |
+
"\n",
|
53 |
+
"clear_output()\n",
|
54 |
+
"%xterm"
|
55 |
+
]
|
56 |
+
}
|
57 |
+
]
|
58 |
+
}
|