From 6e7e9f25886696e5a500b007bfce9703929edbd1 Mon Sep 17 00:00:00 2001 From: Abdul Rehman Kalsekar <78557959+arkalsekar@users.noreply.github.com> Date: Sat, 1 Oct 2022 00:11:51 +0530 Subject: [PATCH 1/2] added main script A project that can change your desktop wallpaper automatically. --- Auto_Wallpaper_Changer/main_changer.py | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Auto_Wallpaper_Changer/main_changer.py diff --git a/Auto_Wallpaper_Changer/main_changer.py b/Auto_Wallpaper_Changer/main_changer.py new file mode 100644 index 0000000..7879d3f --- /dev/null +++ b/Auto_Wallpaper_Changer/main_changer.py @@ -0,0 +1,44 @@ +import os +import requests +import wget +import subprocess +import time + +def get_wallpaper(): + url = 'https://api.unsplash.com/photos/random?client_id=ZQfcb7DPk5z8ZH5W7Zaij6xG33M9U9BJ8ddfYifV6_E' + params = { + 'query': 'HD wallpapers', + 'orientation': 'landscape' + } + + response = requests.get(url, params=params).json() + image_source = response['urls']['full'] + + image = wget.download(image_source, 'D:\\Abdul Rehman\\AI Automations\\Unsplash_Images_API\\Images') + return image + +def change_wallpaper(): + wallpaper = get_wallpaper() + cmd = """/usr/bin/osascript< Date: Sat, 1 Oct 2022 00:18:12 +0530 Subject: [PATCH 2/2] Uploaded a Chrome Dinosaur Game automation script A script that can play Chrome Dinosaur Game for you. --- Dino Automation/main.py | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Dino Automation/main.py diff --git a/Dino Automation/main.py b/Dino Automation/main.py new file mode 100644 index 0000000..71e888d --- /dev/null +++ b/Dino Automation/main.py @@ -0,0 +1,46 @@ +import pyautogui # pip install pyautogui +from PIL import Image, ImageGrab # pip install pillow +from numpy import asarray +import time + +def click(key): + pyautogui.keyDown(key) + return + +def isCollision(data): +# Check colison for birds + for i in range(530,560): + for j in range(80, 127): + if data[i, j] < 171: + click("down") + return + # Check colison for cactus + for i in range(530, 620): + for j in range(130, 160): + if data[i, j] < 100: + click("up") + return + return + +if __name__ == "__main__": + time.sleep(5) + click('up') + + while True: + image = ImageGrab.grab().convert('L') + data = image.load() + isCollision(data) + + # # Draw the rectangle for cactus + # for i in range(530, 610): + # for j in range(130, 160): + # data[i, j] = 0 + + # # # Draw the rectangle for birds + # for i in range(530, 560): + # for j in range(100, 125): + # data[i, j] = 171 + + # image.show() + # break + \ No newline at end of file