Skip to content

Updating my fork with changes #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
784bc84
Recursive euclidean algorithm
ramonssarmento Oct 16, 2019
ce20c84
Solved #91 Added : balanced Parenthesis
sameersrivastava13 Aug 14, 2020
79f99f5
Update Contribution.md
powerexploit Aug 14, 2020
743d395
Update Contribution.md
powerexploit Aug 14, 2020
e74b9dd
Update Contribution.md
powerexploit Aug 14, 2020
a849581
Update Contribution.md
powerexploit Aug 14, 2020
4727694
Merge pull request #37 from ramonssarmento/master
powerexploit Aug 15, 2020
6d59af5
Delete recursive_euclidean_algorithm.py
powerexploit Aug 15, 2020
5a1a5a9
Refactored : balanced_paranthsis.py
sameersrivastava13 Aug 15, 2020
59a1f2f
Refactored : balanced_parentheses.py
sameersrivastava13 Aug 15, 2020
550f59c
Junk File Organizer using Python
gulshanbaraik01 Aug 16, 2020
adb16b5
Solved #91 refactored : balanced Parenthesis
sameersrivastava13 Aug 16, 2020
9d69518
Solved #91 Added : balanced Parentheses
sameersrivastava13 Aug 16, 2020
2a35441
Added Scraping Hacker news website script
GudlaArunKumar Aug 16, 2020
a1cb98a
Merge pull request #95 from sameersrivastava13/master
powerexploit Aug 16, 2020
c969801
Merge pull request #1 from ankitdobhal/master
kaustubhgupta Aug 16, 2020
eb92b6b
Added Readme as per PR review
GudlaArunKumar Aug 16, 2020
63360f9
Script to download Medium articles added
Aug 16, 2020
65967e8
Updated script
Aug 16, 2020
bdbba90
medium articles details scrapper
kaustubhgupta Aug 16, 2020
d902317
Script added with README
Aug 16, 2020
838016c
Update Contribution.md
powerexploit Aug 17, 2020
ab55e64
Merge pull request #102 from gulshanbaraik01/Junk-Automation
powerexploit Aug 17, 2020
d56a8c1
Merge pull request #105 from GudlaArunKumar/ScrappingHackerNews
powerexploit Aug 17, 2020
60ac8c8
Invisible Cloak
anisha282000 Aug 17, 2020
e355aa3
Updated the README
Aug 17, 2020
c61ef21
Added Automating code for Google with Python - Issue #94
kritikaparmar-programmer Aug 17, 2020
2577907
Deleted .json file
kritikaparmar-programmer Aug 17, 2020
dd64bb4
All necessary changes made
kaustubhgupta Aug 17, 2020
f2ddecc
Update README.md
kaustubhgupta Aug 17, 2020
b203106
Added Folder and Readme
kritikaparmar-programmer Aug 17, 2020
6970eb4
Added Folder Google
kritikaparmar-programmer Aug 17, 2020
1104372
Delete tic-tac-toe.py
powerexploit Aug 17, 2020
6fca389
added screenshot
kaustubhgupta Aug 17, 2020
6a1d2ca
Update README.md
kaustubhgupta Aug 17, 2020
8ec4b27
Merge pull request #125 from kaustubhgupta/dev
powerexploit Aug 17, 2020
f3a6215
Readme updated
kritikaparmar-programmer Aug 17, 2020
74bba01
Updated readme with new changes
anisha282000 Aug 18, 2020
76d44de
HARRY's invisible cloak
anisha282000 Aug 18, 2020
1f05e72
Delete cloak.py
anisha282000 Aug 18, 2020
5983c30
Delete README.md
anisha282000 Aug 18, 2020
36fcdcd
Updated README
anisha282000 Aug 18, 2020
2bd178f
Merge pull request #132 from anisha282000/Invisible_cloak
powerexploit Aug 18, 2020
0f38310
Create README.md
powerexploit Aug 18, 2020
38b780d
Merge pull request #117 from arjuaman/master
powerexploit Aug 18, 2020
b05b6a2
Merge pull request #118 from Namyalg/medium-article-downloader
powerexploit Aug 18, 2020
550b652
Merge pull request #144 from kritikaparmar-programmer/addingscript
powerexploit Aug 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Basic-Scripts/balanced_paranthesis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
openBracketList = ["[", "{", "("]
closeBracketList = ["]", "}", ")"]


def check_parentheses(data: str) -> str:
"""
check_parentheses() : Will take a string as an arguement and each time when an open parentheses is encountered
will push it in the stack, and when closed parenthesis is encountered,
will match it with the top of stack and pop it.

Parameters:
data (str): takes a string.

Returns:
str: Returns a string value whether string passed is balanced or Unbalanced.
"""
stack = []
for index in data:
if index in openBracketList:
stack.append(index)
elif index in closeBracketList:
position = closeBracketList.index(index)
if (len(stack) > 0) and (
openBracketList[position] == stack[len(stack) - 1]
):
stack.pop()
else:
return "Unbalanced"
if len(stack) == 0:
return "Balanced"
else:
return "Unbalanced"


if __name__ == "__main__":

data = input("Enter the string to check:\t")
result = check_parentheses(data)
print(result)

Empty file removed Basic-Scripts/tic-tac-toe.py
Empty file.
39 changes: 26 additions & 13 deletions Contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,29 @@
If this is your first time to open source contribution in python So that I have created this repo for all the you to start contributing.

# How to contribute!
## Steps:
* fork the [repository](https://github.com/ankitdobhal/Python-Scripts)
* Clone the fork [repo](https://github.com/ankitdobhal/Python-Scripts)
(git clone https://github.com/ankitdobhal/Python-Scripts)
* Create new branch
(git checkout -b <Your-Branch-Name>)
* Add files in scripts folder
(git add <your-contribution>)
* Add a commit message !
(git commit -a -m "<Added your message>")
* Push changes
(git push origin)
* Create pull requests

## Steps:
- First commment on the issue in which you want to work upon.
- Issue-1 : https://github.com/ankitdobhal/Awesome-Python-Scripts/issues/91
- Issue-2 : https://github.com/ankitdobhal/Awesome-Python-Scripts/issues/92
- Issue-3 : https://github.com/ankitdobhal/Awesome-Python-Scripts/issues/93
- Issue-4 : https://github.com/ankitdobhal/Awesome-Python-Scripts/issues/94

- Fork the [repository](https://github.com/ankitdobhal/Awesome-Python-Scripts)

- Clone the fork [repo](https://github.com/ankitdobhal/Awesome-Python-Scripts)
- git clone https://github.com/<Your_Username>/Awesome-Python-Scripts
- Create new branch
- git checkout -b <Your-Branch-Name>

- Add Scripts related to your respective issues.
- git add <your-contribution>

- Add a commit message !
- git commit -a -m "<Added your message>"

- Push changes
- git push -u origin <name_of_your_branch>

- Create pull requests
- [Try to Mention the related issue for your PR]
20 changes: 20 additions & 0 deletions Image-Processing/Invisible_cloak/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Invisible Cloak
This is a python script about the cloak of invisibility which was used by harry to become invisible.

## How it works
* It captures and store the background.
* Detect the defined color using color detection.
* Segment out the red colored cloth by generating a mask.
* Generate the final augmented output to create a magical effect.

## Installation
* Use the package manager [pip](https://pip.pypa.io/en/stable/) to install Opencv.

```bash
pip install opencv-python
```
* Install Numpy

```bash
pip install numpy
```
63 changes: 63 additions & 0 deletions Image-Processing/Invisible_cloak/cloak.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import numpy as np
import cv2
import time

print("""
BE PREPARE YOU WILL BE INVISIBLE SOON............
""")

if __name__ == '__main__':
cap = cv2.VideoCapture(0)

#For capturing output video
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('harry.avi' , fourcc, 20.0, (640,480))
time.sleep(2)
background = 0

#capturing background
for i in range(30):
ret, background = cap.read()

#capturing image
while(cap.isOpened()):
ret, img = cap.read()

if not ret:
break
#HSV stands for Hue Satrurated Value
hsv=cv2.cvtColor(img, cv2.COLOR_BGR2HSV)

#YOU CAN CHANGE THE COLOR VALUE BELOW ACCORDING TO YOUR CLOTH COLOR
lower_red = np.array([0,120,70])
upper_red = np.array([10,255,255])
mask1 = cv2.inRange(hsv , lower_red , upper_red)

lower_red = np.array([170,120,70])
upper_red = np.array([180,255,255])
mask2 = cv2.inRange(hsv , lower_red , upper_red)

mask1 = mask1 + mask2

#Open and clean the mask image
mask1=cv2.morphologyEx(mask1, cv2.MORPH_OPEN ,np.ones((3,3) , np.uint8) , iterations=2)

mask2=cv2.morphologyEx(mask1, cv2.MORPH_DILATE ,np.ones((3,3) , np.uint8) , iterations=1)

mask2 = cv2.bitwise_not(mask1)

#Generating the final output
res1 = cv2.bitwise_and(background, background, mask=mask1)
res2 = cv2.bitwise_and(img, img, mask=mask2)

final_output = cv2.addWeighted(res1 , 1, res2 , 1, 0)

cv2.imshow('Invisibility Game' , final_output)
k=cv2.waitKey(10)
if k==27:
print("Escape hit, closing...")
break

cap.release()
out.release()
cv2.destroyAllWindows()
2 changes: 2 additions & 0 deletions Image-Processing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Image-Processing
Image processing has been used to create weird and beautiful modifications to pictures many of us have seen online. Older black and white photos can be brought to life using colorization techniques. On the other hand, color photos can be made to look like old black and white photos. In addition to distorting images for entertainment, image processing can be used for more serious applications, for example, to enhance medical imaging to screen patients for cancer or other diseases.
38 changes: 38 additions & 0 deletions System-Automation-Scripts/Google/Automating_Google.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# In this script we will automate Google using Selenium

# Imports :
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from time import sleep
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager().install())

# enter the link of the google
driver.get("https://www.google.com")

# AUTOMATING CLICKING OF THE LINK TEXT

# enter the name of the text
element = driver.find_element_by_link_text("About")

# delaying by 2 sec
time.sleep(2)
# clicking of the element is done by the below click method
element.click()
time.sleep(5)

# AUTOMATING CLICKING OF BACKWARD AND FOORWARD BUTTON

# going backward
driver.back()

time.sleep(5)

# going forward
driver.forward()

# AUTOMATING THE REFRESH OF THE WEBPAGE
time.sleep(10)
driver.refresh()
27 changes: 27 additions & 0 deletions System-Automation-Scripts/Google/Automating_Google_Search.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# In this script we will automate Google Search using Selenium

# Imports :
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from time import sleep
from webdriver_manager.chrome import ChromeDriverManager


driver = webdriver.Chrome(ChromeDriverManager().install())

# providing the link
driver.get("https://www.google.com")

# then we will look for the search bar name(here name is referred to the html code)
element = driver.find_element_by_name("q")

# this is to provide some delay so that we can easily see the process
time.sleep(2)
element.clear()

# here whatever we have to search we can write between the parenthesis
element.send_keys("Python")

# for the enter button
element.send_keys(Keys.RETURN)
14 changes: 14 additions & 0 deletions System-Automation-Scripts/Google/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# System-Automation-Scripts
## Automating Google using Selenium

#### Install Requirements :
1. Install Selenium by writing the following pip command, at command prompt -
> pip install selenium

2. Install ChromeDriver

#### Automating_Google_Search.py
- This file contains the script to automate the Google Search , you just have to enter whatever you want to search & run the file.

#### Automating_Google.py
- This file contains the script to automate various tasks on Google like clicking the text link, cliking the forward and the backward button and refreshing of the page .
52 changes: 52 additions & 0 deletions System-Automation-Scripts/junk_organiser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
from pathlib import Path as pt

DIRECTORIES = {
"HTML": [".html5", ".html", ".htm", ".xhtml"],
"IMAGES": [".jpeg", ".jpg", ".tiff", ".gif", ".bmp", ".png", ".bpg", "svg",
".heif", ".psd"],
"VIDEOS": [".avi", ".flv", ".wmv", ".mov", ".mp4", ".webm", ".vob", ".mng",
".qt", ".mpg", ".mpeg", ".3gp"],
"DOCUMENTS": [".oxps", ".epub", ".pages", ".docx", ".doc", ".fdf", ".ods",
".odt", ".pwi", ".xsn", ".xps", ".dotx", ".docm", ".dox",
".rvg", ".rtf", ".rtfd", ".wpd", ".xls", ".xlsx", ".ppt",
"pptx"],
"ARCHIVES": [".a", ".ar", ".cpio", ".iso", ".tar", ".gz", ".rz", ".7z",
".dmg", ".rar", ".xar", ".zip"],
"AUDIO": [".aac", ".aa", ".aac", ".dvf", ".m4a", ".m4b", ".m4p", ".mp3",
".msv", "ogg", "oga", ".raw", ".vox", ".wav", ".wma"],
"PLAINTEXT": [".txt", ".in", ".out"],
"PDF": [".pdf"],
"PYTHON": [".py"],
"C": [".c"],
"CPP": [".cpp"],
"JAVA": [".java"],
"XML": [".xml"],
"EXE": [".exe"],
"SHELL": [".sh"]

}

FILE_FORMATS = {file_format: directory
for directory, file_formats in DIRECTORIES.items()
for file_format in file_formats}

def org_junk():
for entry in os.scandir():
if entry.is_dir():
continue
file_path = pt(entry)
file_format = file_path.suffix.lower()
if file_format in FILE_FORMATS:
directory_path = pt(FILE_FORMATS[file_format])
directory_path.mkdir(exist_ok=True)
file_path.rename(directory_path.joinpath(file_path))

for dir in os.scandir():
try:
os.rmdir(dir)
except:
pass

if __name__ == "__main__":
org_junk()
4 changes: 4 additions & 0 deletions Web-Scraping/Medium-Articles-Details-Scrapping/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Unnecesaary Files

app/__pycahce__/
.idea
42 changes: 42 additions & 0 deletions Web-Scraping/Medium-Articles-Details-Scrapping/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Medium-Articles-Details-Scrapping
This script will scrap details about medium articles published in a date range in the given publication. The dates are choosen randomly. If there is no article on that date, then that date is skipped. The results returned is a dataframe which can be saved in any format, currently saves as CSV. Here is the preview of the terminal:
![](terminal-preview.PNG)

# Requirements
- numpy
- pandas
- bs4
- requests

# How to run?
- Run the command: python run.py

# About the Scrap class
A Scrapper to get details about medium articles published in a date range in a Publication by selecting random dates.

Attributes
----------
urls_dict : dict
key-value pairs of the publication name with link. Example:
urls_dict={"The Startup":"https://medium.com/swlh"}

start_date : str
starting date of the search. Default: 2020-01-01

end_date : str
ending date of the search. Default: 2020-08-01

year : int
year in which search has to be done. Default: 2020

number: int
number of random dates you want to pick. Default: 10

Methods
-------
scrap():
Scrapping process will be initiated by this method.

dataframe():
Returns the dataframe object.

Loading