Created
August 5, 2024 02:55
-
-
Save trinhtuanvubk/d4fac56d7d5bc71cace5789baa76218f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| keep colab alive | |
| Open the devtools and copy & paste to run the scrips. | |
| const ping = () => { | |
| const btn = document.querySelector("colab-connect-button"); | |
| const inner_btn = btn.shadowRoot.querySelector("#connect"); | |
| if (inner_btn) { | |
| inner_btn.click(); | |
| console.log("Clicked on connect button"); | |
| } else { | |
| console.log("connect button not found"); | |
| } | |
| const nextTime = 50000 + Math.random() * 10000; | |
| setTimeout(ping, nextTime); | |
| }; | |
| ping(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment