Browse Source

++rat-race

master
Maxim Likhachev 4 years ago
parent
commit
a41ac9102a
  1. 1
      README.md
  2. 41
      scripts/rat-race

1
README.md

@ -80,6 +80,7 @@ will create the symbolic link for each script in the \<path> directory.
- [defgroups](scripts/defgroups) adds a user to default system groups. - [defgroups](scripts/defgroups) adds a user to default system groups.
- [passgen](scripts/passgen) creates the strong passwords. - [passgen](scripts/passgen) creates the strong passwords.
- [rat-race](scripts/rat-race) perpetually and randomly moves the mouse cursor.
- [sync-date](scripts/sync-date) sets system time according to Google. - [sync-date](scripts/sync-date) sets system time according to Google.
- [xsmartlight](scripts/xsmartlight) allows to adjust ASUS smartscreen's brightness. - [xsmartlight](scripts/xsmartlight) allows to adjust ASUS smartscreen's brightness.
- [use](scripts/use) shows Gentoo USE flag's description. - [use](scripts/use) shows Gentoo USE flag's description.

41
scripts/rat-race

@ -0,0 +1,41 @@
#!/usr/bin/env python3
#
# This simple scenario moves the mouse cursor every N seconds,
# keeping the input devices active and preventing the computer
# from going into sleep/standby mode.
#
# Requirements:
#
# python:
# - pyautogui
#
# MacOS:
# - add iTerm to Settings -> Security & Privacy -> Accessibility.
#
import pyautogui
import random
import time
import sys
def timestamp():
return time.strftime("%Y-%H-%M %T", time.localtime(int(time.time())))
t = 1 if len(sys.argv) == 1 else int(sys.argv[1])
screenWidth, screenHeight = pyautogui.size()
print(f"[{timestamp()}] Rat-race scenario is started.")
print(f"[{timestamp()}] The mouse cursor will move every {t} seconds.")
print(f"[{timestamp()}] Current screen resolution is {screenWidth}x{screenHeight}.")
while True:
x, y = random.randrange(screenWidth), random.randrange(screenHeight)
print(f"[{timestamp()}] > moving the cursor to point {x : >4},{y}")
pyautogui.moveTo(x, y)
time.sleep(t)
Loading…
Cancel
Save