mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-03-13 17:19:50 +00:00
Merge branch 'metafy-social:master' into master
This commit is contained in:
commit
f7a07c4e24
38
.github/workflows/checker.yml
vendored
Normal file
38
.github/workflows/checker.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: PR has a valid Issue?
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [ edited, synchronize, opened, reopened ]
|
||||
|
||||
jobs:
|
||||
checker:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Issue Validator
|
||||
uses: HarshCasper/validate-issues-over-pull-requests@v0.1.1
|
||||
id: validator
|
||||
with:
|
||||
prbody: ${{ github.event.pull_request.body }}
|
||||
prurl: ${{ github.event.pull_request.url }}
|
||||
|
||||
- name: PR has a valid Issue
|
||||
if: ${{ steps.validator.outputs.valid == 1 }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PRNUM: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
gh pr edit $PRNUM --add-label "PR:Ready-to-Review"
|
||||
gh pr edit $PRNUM --add-label "hacktoberfest-accepted"
|
||||
gh pr edit $PRNUM --remove-label "PR:No-Issue"
|
||||
|
||||
- name: PR has no valid Issue
|
||||
if: ${{ steps.validator.outputs.valid == 0 }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PRNUM: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
gh pr comment $PRNUM --body "PR is not linked to any issue, please make the corresponding changes in the body."
|
||||
gh pr edit $PRNUM --add-label "PR:No-Issue"
|
57
README.md
57
README.md
@ -116,21 +116,28 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
||||
<sub><b>Montek</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Mr-DJ">
|
||||
<img src="https://avatars.githubusercontent.com/u/28898632?v=4" width="100;" alt="Mr-DJ"/>
|
||||
<br />
|
||||
<sub><b>Samuel Jonathan</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/agnxsh">
|
||||
<img src="https://avatars.githubusercontent.com/u/80243668?v=4" width="100;" alt="agnxsh"/>
|
||||
<br />
|
||||
<sub><b>Agnish Ghosh</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/kriptonian1">
|
||||
<img src="https://avatars.githubusercontent.com/u/74916308?v=4" width="100;" alt="kriptonian1"/>
|
||||
<br />
|
||||
<sub><b>Sawan Bhattacharya</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Prajwol-Shrestha">
|
||||
<img src="https://avatars.githubusercontent.com/u/70046321?v=4" width="100;" alt="Prajwol-Shrestha"/>
|
||||
@ -165,15 +172,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
||||
<br />
|
||||
<sub><b>Dishant Nagpal</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/SiddheshKukade">
|
||||
<img src="https://avatars.githubusercontent.com/u/65951872?v=4" width="100;" alt="SiddheshKukade"/>
|
||||
<br />
|
||||
<sub><b>Siddhesh Bhupendra Kuakde</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/aswin2108">
|
||||
<img src="https://avatars.githubusercontent.com/u/72661784?v=4" width="100;" alt="aswin2108"/>
|
||||
@ -181,6 +188,13 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
||||
<sub><b>Aswin Shailajan</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/lordvader501">
|
||||
<img src="https://avatars.githubusercontent.com/u/60027612?v=4" width="100;" alt="lordvader501"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/noobyysauraj">
|
||||
<img src="https://avatars.githubusercontent.com/u/81681419?v=4" width="100;" alt="noobyysauraj"/>
|
||||
@ -195,6 +209,14 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
||||
<sub><b>Srinjoy Pati</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/accodes21">
|
||||
<img src="https://avatars.githubusercontent.com/u/101868279?v=4" width="100;" alt="accodes21"/>
|
||||
<br />
|
||||
<sub><b>Aarya Chopkar</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/akashJainAJ11">
|
||||
<img src="https://avatars.githubusercontent.com/u/94193834?v=4" width="100;" alt="akashJainAJ11"/>
|
||||
@ -215,8 +237,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
||||
<br />
|
||||
<sub><b>Sarthak Roy</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/anjali1102">
|
||||
<img src="https://avatars.githubusercontent.com/u/56559378?v=4" width="100;" alt="anjali1102"/>
|
||||
@ -237,14 +258,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/lordvader501">
|
||||
<img src="https://avatars.githubusercontent.com/u/60027612?v=4" width="100;" alt="lordvader501"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/yashbrid03">
|
||||
<img src="https://avatars.githubusercontent.com/u/65955929?v=4" width="100;" alt="yashbrid03"/>
|
||||
@ -252,14 +267,20 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
||||
<sub><b>Yash Nilesh Brid</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/mclmza">
|
||||
<img src="https://avatars.githubusercontent.com/u/7353871?v=4" width="100;" alt="mclmza"/>
|
||||
<br />
|
||||
<sub><b>Michele Mazza</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/mer747">
|
||||
<img src="https://avatars.githubusercontent.com/u/84189502?v=4" width="100;" alt="mer747"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/smit-sms">
|
||||
<img src="https://avatars.githubusercontent.com/u/52400400?v=4" width="100;" alt="smit-sms"/>
|
||||
|
9
scripts/Crawl Google Results/README.md
Normal file
9
scripts/Crawl Google Results/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Crawl Google results
|
||||
This is a simple script that lets you collect results provided by Google.
|
||||
|
||||
## Usage
|
||||
|
||||
* 3 packages required requests, BeautifulSoup and fake_useragent
|
||||
* Use `pip install requests`, `pip install bs4` and `pip install fake_useragent`
|
||||
* Add path to your csv file and output excel file WITH EXTENSTION `.csv` and `.xlsx`
|
||||
* Run `python main.py "query search"`
|
24
scripts/Crawl Google Results/main.py
Normal file
24
scripts/Crawl Google Results/main.py
Normal file
@ -0,0 +1,24 @@
|
||||
import sys
|
||||
import webbrowser
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from fake_useragent import UserAgent
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Googling.....")
|
||||
url = "https://www.google.com/search?q=" + " ".join(sys.argv[1:])
|
||||
res = requests.get(url, headers={"UserAgent": UserAgent().random})
|
||||
# res.raise_for_status()
|
||||
with open("project1a.html", "wb") as out_file: # only for knowing the class
|
||||
for data in res.iter_content(10000):
|
||||
out_file.write(data)
|
||||
soup = BeautifulSoup(res.text, "html.parser")
|
||||
links = list(soup.select(".eZt8xd"))[:5]
|
||||
|
||||
print(len(links))
|
||||
for link in links:
|
||||
if link.text == "Maps":
|
||||
webbrowser.open(link.get("href"))
|
||||
else:
|
||||
webbrowser.open(f"http://google.com{link.get('href')}")
|
21
scripts/Image_resizer/readme.md
Normal file
21
scripts/Image_resizer/readme.md
Normal file
@ -0,0 +1,21 @@
|
||||
# IMAGE RESIZER
|
||||
### Resize image to partiular dimensions.
|
||||
|
||||
This python code takes image that needs to be resised and it uses Pillow module to resize the image by given dimensions entered by user and saves the resized image.
|
||||
|
||||
#### Requirements:
|
||||
* Install Pillow module.
|
||||
* run `pip install pillow`
|
||||
|
||||
### Usage
|
||||
* Clone the repo
|
||||
* open the `Image-resizer` folder
|
||||
* copy the image that you want to resize to this folder
|
||||
* open cmd in `image-resizer` folder
|
||||
##### for windows
|
||||
* run `python resize.py`
|
||||
##### for linux
|
||||
* run `python3 resize.py`
|
||||
* after that type the name of the image file in images folder (ex: img.jpg, pic.png...)
|
||||
* enter the dimensions in the format(eg 1024x720 , 600x300...)
|
||||
* now your resized image is saved in folder.
|
11
scripts/Image_resizer/resize.py
Normal file
11
scripts/Image_resizer/resize.py
Normal file
@ -0,0 +1,11 @@
|
||||
from PIL import Image as img
|
||||
import os
|
||||
|
||||
file_name = input("Enter anpe of file: ")
|
||||
name , ext = file_name.split('.')
|
||||
pic = img.open((os.path.join(os.path.dirname(os.path.abspath(__file__)),file_name)))
|
||||
|
||||
ht, wt= input("Enter dimenstions(eg: 1024x720): ").split('x')
|
||||
dim = int(ht), int(wt)
|
||||
img_resize = pic.resize(dim)
|
||||
img_resize.save((os.path.join(os.path.dirname(os.path.abspath(__file__)),f'{name}_resized.{ext}')))
|
10
scripts/SnakeGame/SnakeGame.md
Normal file
10
scripts/SnakeGame/SnakeGame.md
Normal file
@ -0,0 +1,10 @@
|
||||
## Snake Game
|
||||
GUI based Snake game, where you can play it directly without installing any dependencies.
|
||||
|
||||
## How to install?
|
||||
`1.` Download the file rock_paper_scissor.py
|
||||
`2.` Open CMD (Command Prompt)
|
||||
`3.` Run python rock_paper_scissor.py
|
||||
`4.` Follow the instructions and enjoy!
|
||||
|
||||
Enjoy and play with your friends
|
175
scripts/SnakeGame/SnakeGame.py
Normal file
175
scripts/SnakeGame/SnakeGame.py
Normal file
@ -0,0 +1,175 @@
|
||||
import turtle
|
||||
import time
|
||||
import random
|
||||
|
||||
delay = 0.1
|
||||
score = 0
|
||||
high_score = 0
|
||||
|
||||
#Window Screen
|
||||
wn = turtle.Screen()
|
||||
wn.title("SNAKE GAME")
|
||||
wn.bgcolor("black")
|
||||
|
||||
wn.setup(width=600,height=600)
|
||||
wn.tracer(0)
|
||||
|
||||
#Head of Snake
|
||||
head = turtle.Turtle()
|
||||
head.shape("square")
|
||||
head.color("green")
|
||||
head.penup()
|
||||
head.goto(0, 0)
|
||||
head.direction = "stop"
|
||||
|
||||
#Food in the game
|
||||
food = turtle.Turtle()
|
||||
food.speed(0)
|
||||
food.shape("circle")
|
||||
food.color("red")
|
||||
food.penup()
|
||||
food.goto(0, 100)
|
||||
|
||||
#Score
|
||||
pen = turtle.Turtle()
|
||||
pen.speed(0)
|
||||
pen.shape("turtle")
|
||||
pen.color("white")
|
||||
pen.penup()
|
||||
pen.hideturtle()
|
||||
pen.goto(0, 250)
|
||||
pen.write("Score : 0 High Score : 0", align="center",
|
||||
font=("Times New Roman", 24, "bold"))
|
||||
|
||||
|
||||
#Assigning key values
|
||||
def goup():
|
||||
if head.direction != "down":
|
||||
head.direction = "up"
|
||||
|
||||
def godown():
|
||||
if head.direction != "up":
|
||||
head.direction = "down"
|
||||
|
||||
def goright():
|
||||
if head.direction != "left":
|
||||
head.direction = "right"
|
||||
|
||||
def goleft():
|
||||
if head.direction != "right":
|
||||
head.direction = "left"
|
||||
|
||||
def move():
|
||||
if head.direction == "up":
|
||||
y = head.ycor()
|
||||
head.sety(y+20)
|
||||
|
||||
if head.direction == "down":
|
||||
y = head.ycor()
|
||||
head.sety(y-20)
|
||||
|
||||
if head.direction == "right":
|
||||
x = head.xcor()
|
||||
head.setx(x+20)
|
||||
|
||||
if head.direction == "left":
|
||||
x = head.xcor()
|
||||
head.setx(x-20)
|
||||
|
||||
wn.listen()
|
||||
wn.onkeypress(goup, "Up")
|
||||
wn.onkeypress(godown, "Down")
|
||||
wn.onkeypress(goleft, "Left")
|
||||
wn.onkeypress(goright, "Right")
|
||||
|
||||
|
||||
#Main Loop
|
||||
segments = []
|
||||
|
||||
while True:
|
||||
wn.update()
|
||||
#for collisions with border
|
||||
if head.xcor() > 290 or head.xcor() < -290 or head.ycor() > 290 or head.ycor() < -290:
|
||||
time.sleep(1)
|
||||
head.goto(0, 0)
|
||||
head.direction = "stop"
|
||||
|
||||
#hiding segments of snake
|
||||
for segment in segments:
|
||||
segment.goto(1000,1000)
|
||||
#clearing the segments
|
||||
segments.clear()
|
||||
|
||||
#reset score
|
||||
score = 0
|
||||
|
||||
#reset delay
|
||||
delay = 0.1
|
||||
|
||||
pen.clear()
|
||||
pen.write("Score : {} High Score : {} ".format(
|
||||
score, high_score), align="center", font=("Times New Roman", 24, "bold"))
|
||||
|
||||
#checking collision with food
|
||||
if head.distance(food) < 20:
|
||||
x = random.randint(-270, 270)
|
||||
y = random.randint(-270, 270)
|
||||
food.goto(x, y)
|
||||
d = ["red","yellow","blue"]
|
||||
colors = random.choice(d)
|
||||
food.color(colors)
|
||||
e = ["circle","square","triangle"]
|
||||
shapes = random.choice(e)
|
||||
food.shape(shapes)
|
||||
|
||||
|
||||
#adding new segment
|
||||
new_segment = turtle.Turtle()
|
||||
new_segment.speed(0)
|
||||
new_segment.color("green")
|
||||
new_segment.shape("square")
|
||||
new_segment.penup()
|
||||
segments.append(new_segment)
|
||||
|
||||
delay -= 0.001
|
||||
score += 10
|
||||
|
||||
if score>high_score:
|
||||
high_score = score
|
||||
pen.clear()
|
||||
pen.write("Score : {} High Score : {} ".format(
|
||||
score, high_score), align="center", font=("Times New Roman", 24, "bold"))
|
||||
|
||||
#moving segments in reverse order
|
||||
for i in range(len(segments)-1,0,-1):
|
||||
x = segments[i-1].xcor()
|
||||
y = segments[i-1].ycor()
|
||||
segments[i].goto(x,y)
|
||||
if len(segments) > 0:
|
||||
x = head.xcor()
|
||||
y = head.ycor()
|
||||
segments[0].goto(x, y)
|
||||
|
||||
move()
|
||||
|
||||
#Checking collisions with body
|
||||
for segment in segments:
|
||||
if segment.distance(head) < 20:
|
||||
time.sleep(1)
|
||||
head.goto(0,0)
|
||||
head.direction = "stop"
|
||||
|
||||
#hide segments
|
||||
for segment in segments:
|
||||
segment.goto(1000,1000)
|
||||
segment.clear()
|
||||
|
||||
score = 0
|
||||
delay = 0.1
|
||||
pen.clear()
|
||||
pen.write("Score : {} High Score : {} ".format(
|
||||
score, high_score), align="center", font=("Times New Roman", 24, "bold"))
|
||||
time.sleep(delay)
|
||||
|
||||
turtle.done()
|
||||
|
Loading…
x
Reference in New Issue
Block a user