Skip to content

Instantly share code, notes, and snippets.

@volkanozcan2
Created May 16, 2022 20:42
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 volkanozcan2/e25a4bb1b4d75eaf4b77d0d14921fa13 to your computer and use it in GitHub Desktop.
Save volkanozcan2/e25a4bb1b4d75eaf4b77d0d14921fa13 to your computer and use it in GitHub Desktop.
google colab prevent disconnection if possible.
#@markdown #**Anti-Disconnect for Google Colab**
#@markdown ## Run this to stop it from disconnecting automatically
#@markdown **(disconnects anyhow after 6 - 12 hrs for using the free version of Colab.)**
#@markdown *(Pro users will get about 24 hrs usage time[depends])*
#@markdown ---
import IPython
js_code = '''
function ClickConnect(){
console.log("Working");
document.querySelector("colab-toolbar-button#connect").click()
}
setInterval(ClickConnect,60000)
'''
display(IPython.display.Javascript(js_code))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment