Posts

Python Script to Keep Windows Alive

import time import ctypes from datetime import datetime # Win32 API key event codes KEYEVENTF_KEYUP = 0x0002 VK_SHIFT = 0x10  # Virtual-key code for SHIFT key def press_key(vk_code):     # Press key down     ctypes.windll.user32.keybd_event(vk_code, 0, 0, 0)     time.sleep(0.05)     # Release key     ctypes.windll.user32.keybd_event(vk_code, 0, KEYEVENTF_KEYUP, 0) if __name__ == "__main__":     runtime_hours = 9     runtime_seconds = runtime_hours * 60 * 60     start_time = time.time()     end_time = start_time + runtime_seconds     # Print planned stop time     print(f"Keep-alive script running for {runtime_hours} hours.")     stop_time_str = datetime.fromtimestamp(end_time).strftime("%Y-%m-%d %H:%M:%S")     print(f"Will stop at: {stop_time_str}\n")     while True:         press_key(VK_SHIFT)   # simulate pressing...

Python Windows Install & Intellij Set up

🔹 Step 1: Install Python on Windows Download Python Go to the official site: python.org/downloads Download the latest stable version (e.g., Python 3.12.x). Run Installer During installation, check ✅ “Add Python to PATH” (very important, like adding JAVA_HOME/bin to PATH). Choose “Install Now”. Verify Installation Open Command Prompt and run: python --version or py --version You should see something like: Python 3.12.3 🔹 Step 2: Install IntelliJ IDEA + Python Plugin (PyCharm inside IntelliJ) Since you already use IntelliJ for Java, you can avoid installing PyCharm separately. IntelliJ supports Python via a plugin. Open IntelliJ IDEA Go to File → Settings → Plugins . Search for Python . Install “Python” plugin (by JetBrains). Restart IntelliJ. ✅ If you prefer, you can also install PyCharm Community Edition (free) separately, which is a Python-focused IDE. But IntelliJ + plugin works well. 🔹 Step 3: Configure Python SDK ...