mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-27 14:01:09 +00:00
Compare commits
7 Commits
8035043690
...
7ed9a4835a
Author | SHA1 | Date | |
---|---|---|---|
|
7ed9a4835a | ||
|
f0ea440d41 | ||
|
8c995f4e00 | ||
|
d8880df87b | ||
|
e261ff5240 | ||
|
d678b2bb0e | ||
|
6e7e9f2588 |
44
Auto_Wallpaper_Changer/main_changer.py
Normal file
44
Auto_Wallpaper_Changer/main_changer.py
Normal file
|
@ -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<<END
|
||||
tell application "Finder"
|
||||
set desktop picture to POSIX file "%s"
|
||||
end tell
|
||||
END"""
|
||||
|
||||
subprocess.Popen(cmd%wallpaper, shell=True)
|
||||
subprocess.call(["killall Dock"], shell=True)
|
||||
|
||||
def main():
|
||||
try:
|
||||
while True:
|
||||
change_wallpaper()
|
||||
time.sleep(10)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("\nHope you like this one! Quitting.")
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
46
Dino Automation/main.py
Normal file
46
Dino Automation/main.py
Normal file
|
@ -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
|
||||
|
18
README.md
18
README.md
|
@ -1,4 +1,6 @@
|
|||
# Awesome Python Scripts :sunglasses: <img alt="PyPI" src="https://warehouse-camo.cmh1.psfhosted.org/18509a25dde64f893bd96f21682bd6211c3d4e80/68747470733a2f2f696d672e736869656c64732e696f2f707970692f707976657273696f6e732f64796e61636f6e662e737667"> [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/hastagAB/Awesome-Python-Scripts) ![GitHub stars](https://img.shields.io/github/stars/hastagAB/Awesome-Python-Scripts?style=social)
|
||||
# Awesome Python Scripts :snake:
|
||||
|
||||
<img alt="PyPI" src="https://pypi.org/static/images/logo-small.8998e9d1.svg" height="30px" width="auto"> [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/hastagAB/Awesome-Python-Scripts) ![GitHub stars](https://img.shields.io/github/stars/hastagAB/Awesome-Python-Scripts?style=social)
|
||||
|
||||
|
||||
## Contents:
|
||||
|
@ -197,15 +199,15 @@ Remember to star the repo if you love the scripts~ :wink:
|
|||
- Only One Commit per PR is Adviced.
|
||||
|
||||
# If you like the project:
|
||||
- Star this Repo - [Awesome Python Scripts](https://github.com/hastagAB/Awesome-Python-Scripts)
|
||||
- **Star this Repo - [Awesome Python Scripts](https://github.com/hastagAB/Awesome-Python-Scripts)**
|
||||
|
||||
- Follow me on GitHub - [Ayush Bhardwaj](https://github.com/hastagAB)
|
||||
- **Follow me on GitHub - [Ayush Bhardwaj](https://github.com/hastagAB)**
|
||||
|
||||
# Want to connect with me?
|
||||
- [LinkedIn](https://www.linkedin.com/in/hastagab/)
|
||||
- [Twitter](https://twitter.com/HastagAB)
|
||||
- [Facebook](https://www.facebook.com/SirHastagAB)
|
||||
- [Instagram](https://www.instagram.com/sirhastagab/)
|
||||
## Want to Connect with Me?
|
||||
[<img src="https://content.linkedin.com/content/dam/me/business/en-us/amp/brand-site/v2/bg/LI-Bug.svg.original.svg" height="30px" alt="Linkedin">](https://www.linkedin.com/in/hastagab/)
|
||||
[<img src="https://static.dezeen.com/uploads/2023/07/x-logo-twitter-elon-musk_dezeen_2364_col_0.jpg" height="30px" alt="X/Twitter">](https://twitter.com/HastagAB)
|
||||
[<img src="https://w7.pngwing.com/pngs/561/460/png-transparent-fb-facebook-facebook-logo-social-media-icon-thumbnail.png" height="30px" alt="Facebook">](https://www.facebook.com/SirHastagAB)
|
||||
[<img src="https://static.cdninstagram.com/rsrc.php/v3/yI/r/VsNE-OHk_8a.png" height="31px" alt="Instagram">](https://www.instagram.com/sirhastagab/)
|
||||
|
||||
|
||||
[![](https://img.shields.io/badge/Made%20With%20❤️%20By-HastagAB-red)](https://github.com/hastagAB)
|
||||
|
|
|
@ -2,4 +2,4 @@ certifi==2023.7.22
|
|||
chardet==3.0.4
|
||||
idna==2.8
|
||||
requests==2.31.0
|
||||
urllib3==1.26.18
|
||||
urllib3==1.26.19
|
||||
|
|
Loading…
Reference in New Issue
Block a user