Skip to content

Instantly share code, notes, and snippets.

@vchrombie
Last active April 1, 2020 14:21
Show Gist options
  • Save vchrombie/c6e0fd25594a1f126e1a2a5884bb782e to your computer and use it in GitHub Desktop.
Save vchrombie/c6e0fd25594a1f126e1a2a5884bb782e to your computer and use it in GitHub Desktop.
super awesome script for not letting the computer go to sleep

super awesome script for lazy programmers who don't want to let their laptops go to sleep as something important is running behind and you are too lazy to switch off the go-to-sleep-after-inactivity

what does it do: very simple > moves the mouse pointer 10 px and 10 px down, in a loop

why the script

  • computer sleeping, while running something on behind, sucks 🤢
  • automating is fun ✌️
  • python is ❤️

requirements: install pyautogui

python3 -m pip install pyautogui

steps to use this script safely

  1. make sure you are battery level is good
  2. run the background processes behind
  3. open a terminal, maximize it
  4. run the script
python3 script.py

that's it, you are good to go. you can leave your laptop and go for dinner.

how to resume back: end the script, press CTRL+C

note: good for you if you follow the 3rd step. if don't maximize it, sometimes you might run into trouble as the system might go crazy.

use at your own risk, don't blame @vchrombie

import pyautogui
while(True):
pyautogui.dragRel(0, 10)
pyautogui.dragRel(0, -10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment