-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
""" | ||
Simulate activity on a PC so it doesn't get suspended | ||
""" | ||
import random | ||
import time | ||
|
||
import pyautogui | ||
|
||
SECONDS_TO_SLEEP_IN_BETWEEN: int = 1*60 | ||
|
||
|
||
def custom_random(variance: int, negative_range: bool = True) -> int: | ||
"""Custom random number generation""" | ||
max_number = variance | ||
min_number = 0 | ||
|
||
if negative_range: | ||
max_number /= 2 | ||
min_number -= (variance / 2) | ||
return random.randint(min_number, max_number) | ||
|
||
|
||
def start(): | ||
""" | ||
Main entrypoint | ||
@source https://stackoverflow.com/questions/1181464/controlling-mouse-with-python | ||
""" | ||
while True: | ||
print("moving mouse...") | ||
pyautogui.moveRel(custom_random(20), custom_random(20), .2) | ||
print("mouse moved!") | ||
time.sleep(SECONDS_TO_SLEEP_IN_BETWEEN) | ||
|
||
|
||
if __name__ == "__main__": | ||
start() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pyautogui==0.9.53 |