Created
November 13, 2025 13:41
-
-
Save Ghost---Shadow/f2764e2f9bda705d128b2a684b107440 to your computer and use it in GitHub Desktop.
Latest windows update causes my PC to randomly restart unless I do this. (or maybe its broken ACER drivers)
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
| #!/usr/bin/env python3 | |
| """ | |
| Script to keep Windows awake by typing random ASCII characters. | |
| Press Ctrl+C to stop. | |
| """ | |
| import random | |
| import string | |
| import time | |
| from pynput.keyboard import Controller | |
| def main(): | |
| keyboard = Controller() | |
| # Use printable ASCII characters (letters, digits, punctuation) | |
| ascii_chars = string.ascii_letters + string.digits | |
| print("Starting keep-awake script...") | |
| print("Press Ctrl+C to stop") | |
| print("-" * 40) | |
| try: | |
| while True: | |
| # Generate random ASCII character | |
| char = random.choice(ascii_chars) | |
| # Type the character | |
| keyboard.type(char) | |
| print(f"Typed: {char}", end="\r") | |
| # Wait 1 second | |
| time.sleep(1) | |
| except KeyboardInterrupt: | |
| print("\nScript stopped by user") | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment