Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
160 changes: 80 additions & 80 deletions README.md

Large diffs are not rendered by default.

164 changes: 82 additions & 82 deletions docs/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import requests as rq
from bs4 import BeautifulSoup
url = input("Enter Link: ")
if ("https" or "http") in url:
data = rq.get(url)
else:
data = rq.get("https://" + url)
soup = BeautifulSoup(data.text, "html.parser")
links = []
for link in soup.find_all("a"):
links.append(link.get("href"))
# Writing the output to a file (myLinks.txt) instead of to stdout
# You can change 'a' to 'w' to overwrite the file each time
with open("myLinks.txt", 'a') as saved:
print(links[:10], file=saved)
import requests as rq
from bs4 import BeautifulSoup

url = input("Enter Link: ")
if ("https" or "http") in url:
data = rq.get(url)
else:
data = rq.get("https://" + url)
soup = BeautifulSoup(data.text, "html.parser")
links = []
for link in soup.find_all("a"):
links.append(link.get("href"))

# Writing the output to a file (myLinks.txt) instead of to stdout
# You can change 'a' to 'w' to overwrite the file each time
with open("myLinks.txt", 'a') as saved:
print(links[:10], file=saved)
File renamed without changes.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# pip install psutil
import psutil

battery = psutil.sensors_battery()
plugged = battery.power_plugged
percent = battery.percent

if percent >= 30:

# pip install pynotifier
# pip install win10toast
from pynotifier import Notification

Notification(
title="Battery Low",
description=str(percent) + "% Battery remain!!",
duration=5, # Duration in seconds
urgency=Notification.URGENCY_CRITICAL,
).send()
# pip install psutil
import psutil

battery = psutil.sensors_battery()
plugged = battery.power_plugged
percent = battery.percent

if percent >= 30:

# pip install pynotifier
# pip install win10toast
from pynotifier import Notification

Notification(
title="Battery Low",
description=str(percent) + "% Battery remain!!",
duration=5, # Duration in seconds
urgency=Notification.URGENCY_CRITICAL,
).send()
Empty file.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
import math

one_digit_words = {
'0': ["zero"],
'1': ["one"],
'2': ["two", "twen"],
'3': ["three", "thir"],
'4': ["four", "for"],
'5': ["five", "fif"],
'6': ["six"],
'7': ["seven"],
'8': ["eight"],
'9': ["nine"],
}

two_digit_words = ["ten", "eleven", "twelve"]
hundred = "hundred"
large_sum_words = ["thousand", "million", "billion", "trillion", "quadrillion", "quintillion", "sextillion", "septillion", "octillion", "nonillion"]

def converter(n):
word = []

if n.startswith('-'):
word.append("(negative)")
n = n[1:]

if len(n) % 3 != 0 and len(n) > 3:
n = n.zfill(3 * (((len(n)-1) // 3) + 1))

sum_list = [n[i:i + 3] for i in range(0, len(n), 3)]
skip = False

for i, num in enumerate(sum_list):
if num != '000': skip = False

for _ in range(len(num)):
num = num.lstrip('0')
if len(num) == 1:
if (len(sum_list) > 1 or (len(sum_list) == 1 and len(sum_list[0]) == 3)) and i == len(sum_list) - 1 and (word[-1] in large_sum_words or hundred in word[-1]):
word.append("and")
word.append(one_digit_words[num][0])
num = num[1:]
break

if len(num) == 2:
if num[0] != '0':
if (len(sum_list) > 1 or (len(sum_list) == 1 and len(sum_list[0]) == 3)) and i == len(sum_list) - 1:
word.append("and")
if num.startswith('1'):
if int(num[1]) in range(3):
word.append(two_digit_words[int(num[1])])
else:
number = one_digit_words[num[1]][1 if int(num[1]) in range(3, 6, 2) else 0]
word.append(number + ("teen" if not number[-1] == 't' else "een"))
else:
word.append(one_digit_words[num[0]][1 if int(num[0]) in range(2, 6) else 0] + ("ty " if num[0] != '8' else 'y ') + (one_digit_words[num[1]][0] if num[1] != '0' else ""))
break
else:
num = num[1:]
continue

if len(num) == 3:
if num[0] != '0':
word.append(one_digit_words[num[0]][0] + " " + hundred)
if num[1:] == '00': break
num = num[1:]

if len(sum_list[i:]) > 1 and not skip:
word.append(large_sum_words[len(sum_list[i:]) - 2])
skip = True

word = " ".join(map(str.strip, word))
return word[0].lstrip().upper() + word[1:].rstrip().lower() if "negative" not in word else word[:11].lstrip() + word[11].upper() + word[12:].rstrip().lower()

if __name__ == "__main__":
while True:
try:
n = input("Enter any number to convert it into words or 'exit' to stop: ")
if n == "exit":
break
int(n)
print(n, "-->", converter(n))
except ValueError as e:
import math

one_digit_words = {
'0': ["zero"],
'1': ["one"],
'2': ["two", "twen"],
'3': ["three", "thir"],
'4': ["four", "for"],
'5': ["five", "fif"],
'6': ["six"],
'7': ["seven"],
'8': ["eight"],
'9': ["nine"],
}

two_digit_words = ["ten", "eleven", "twelve"]
hundred = "hundred"
large_sum_words = ["thousand", "million", "billion", "trillion", "quadrillion", "quintillion", "sextillion", "septillion", "octillion", "nonillion"]

def converter(n):
word = []

if n.startswith('-'):
word.append("(negative)")
n = n[1:]

if len(n) % 3 != 0 and len(n) > 3:
n = n.zfill(3 * (((len(n)-1) // 3) + 1))

sum_list = [n[i:i + 3] for i in range(0, len(n), 3)]
skip = False

for i, num in enumerate(sum_list):
if num != '000': skip = False

for _ in range(len(num)):
num = num.lstrip('0')
if len(num) == 1:
if (len(sum_list) > 1 or (len(sum_list) == 1 and len(sum_list[0]) == 3)) and i == len(sum_list) - 1 and (word[-1] in large_sum_words or hundred in word[-1]):
word.append("and")
word.append(one_digit_words[num][0])
num = num[1:]
break

if len(num) == 2:
if num[0] != '0':
if (len(sum_list) > 1 or (len(sum_list) == 1 and len(sum_list[0]) == 3)) and i == len(sum_list) - 1:
word.append("and")
if num.startswith('1'):
if int(num[1]) in range(3):
word.append(two_digit_words[int(num[1])])
else:
number = one_digit_words[num[1]][1 if int(num[1]) in range(3, 6, 2) else 0]
word.append(number + ("teen" if not number[-1] == 't' else "een"))
else:
word.append(one_digit_words[num[0]][1 if int(num[0]) in range(2, 6) else 0] + ("ty " if num[0] != '8' else 'y ') + (one_digit_words[num[1]][0] if num[1] != '0' else ""))
break
else:
num = num[1:]
continue

if len(num) == 3:
if num[0] != '0':
word.append(one_digit_words[num[0]][0] + " " + hundred)
if num[1:] == '00': break
num = num[1:]

if len(sum_list[i:]) > 1 and not skip:
word.append(large_sum_words[len(sum_list[i:]) - 2])
skip = True

word = " ".join(map(str.strip, word))
return word[0].lstrip().upper() + word[1:].rstrip().lower() if "negative" not in word else word[:11].lstrip() + word[11].upper() + word[12:].rstrip().lower()

if __name__ == "__main__":
while True:
try:
n = input("Enter any number to convert it into words or 'exit' to stop: ")
if n == "exit":
break
int(n)
print(n, "-->", converter(n))
except ValueError as e:
print("Error: Invalid Number!")
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import cv2
import numpy as np

path = input("Enter Path :- ")
try:
img = cv2.imread(path)
cv2.imshow("img", img)
except Exception:
print("Path not found")
exit()


array = np.array(img)
unique, counts = np.unique(array, return_counts=True)

ocurrance = dict(zip(unique, counts))


a1_sorted_keys = sorted(ocurrance, key=ocurrance.get, reverse=True)
print(a1_sorted_keys[:3])


# Create a blank 300x300 black image
image = np.zeros((300, 300, 3), np.uint8)
# Fill image with red color(set each pixel to red)
image[:] = a1_sorted_keys[:3]


c = a1_sorted_keys[0]

# Create a blank 300x300 black image
color = np.zeros((300, 300, 3), np.uint8)
# Fill image with red color(set each pixel to red)
color[:] = (c, c, c)

print("Tone : " + str(a1_sorted_keys[:3]))
cv2.imshow("Tone", image)
print("color : " + str([c, c, c]))
cv2.imshow("color", color)
import cv2
import numpy as np

path = input("Enter Path :- ")
try:
img = cv2.imread(path)
cv2.imshow("img", img)
except Exception:
print("Path not found")
exit()


array = np.array(img)
unique, counts = np.unique(array, return_counts=True)

ocurrance = dict(zip(unique, counts))


a1_sorted_keys = sorted(ocurrance, key=ocurrance.get, reverse=True)
print(a1_sorted_keys[:3])


# Create a blank 300x300 black image
image = np.zeros((300, 300, 3), np.uint8)
# Fill image with red color(set each pixel to red)
image[:] = a1_sorted_keys[:3]


c = a1_sorted_keys[0]

# Create a blank 300x300 black image
color = np.zeros((300, 300, 3), np.uint8)
# Fill image with red color(set each pixel to red)
color[:] = (c, c, c)

print("Tone : " + str(a1_sorted_keys[:3]))
cv2.imshow("Tone", image)
print("color : " + str([c, c, c]))
cv2.imshow("color", color)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Scrap images from URL

1. Dowmload Chrome Drive From Chrome.
2. Run scrap-img.py file `py scrap-img.py`
3. `Enter Path : E:\webscraping\chromedriver_win32\chromedriver.exe` <br/>
`Enter URL : https://dribbble.com/`
# Scrap images from URL

1. Dowmload Chrome Drive From Chrome.
2. Run scrap-img.py file `py scrap-img.py`
3. `Enter Path : E:\webscraping\chromedriver_win32\chromedriver.exe` <br/>
`Enter URL : https://dribbble.com/`
Loading