Merge branch 'metafy-social:master' into master

This commit is contained in:
Rahul Karda 2022-10-11 21:11:51 +05:30 committed by GitHub
commit 8200393950
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 413 additions and 38 deletions

View File

@ -21,7 +21,7 @@ jobs:
We at Metafy have some special rewards and swags for the top contributors in general repos and every contributor in web3 repos
For being eligible for that, please authenticate yourself using this link:
https://hacktoberfest.auth.metafy.social
https://metafy.social/signup
Rewards : T-shirts & NFT ( for blockchain contributions )
@ -34,7 +34,7 @@ jobs:
We at Metafy have some special rewards and swags for the top contributors in general repos and every contributor in web3 repos
For being eligible for that, please authenticate yourself using this link:
https://hacktoberfest.auth.metafy.social
https://metafy.social/signup
Rewards : T-shirts & NFT ( for blockchain contributions )

108
README.md
View File

@ -202,6 +202,21 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Mohd Afzal Khan</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/MSVelan">
<img src="https://avatars.githubusercontent.com/u/92083282?v=4" width="100;" alt="MSVelan"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/rahulkarda">
<img src="https://avatars.githubusercontent.com/u/76204863?v=4" width="100;" alt="rahulkarda"/>
<br />
<sub><b>Rahul Karda</b></sub>
</a>
</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"/>
@ -215,8 +230,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Sourodip Kar</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/varunKT001">
<img src="https://avatars.githubusercontent.com/u/83509023?v=4" width="100;" alt="varunKT001"/>
@ -244,7 +258,8 @@ 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/Kunalp02">
<img src="https://avatars.githubusercontent.com/u/95534553?v=4" width="100;" alt="Kunalp02"/>
@ -258,8 +273,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Mysterious-Owl</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/PritamP20">
<img src="https://avatars.githubusercontent.com/u/102867939?v=4" width="100;" alt="PritamP20"/>
@ -267,13 +281,6 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/rahulkarda">
<img src="https://avatars.githubusercontent.com/u/76204863?v=4" width="100;" alt="rahulkarda"/>
<br />
<sub><b>Rahul Karda</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Tiagupt03">
<img src="https://avatars.githubusercontent.com/u/98590820?v=4" width="100;" alt="Tiagupt03"/>
@ -294,15 +301,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Drk1rd</b></sub>
</a>
</td>
</td></tr>
<tr>
<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></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/rohitgarud21">
<img src="https://avatars.githubusercontent.com/u/115347445?v=4" width="100;" alt="rohitgarud21"/>
@ -337,15 +344,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Nishant Pacharne</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/thegeekyb0y">
<img src="https://avatars.githubusercontent.com/u/84658112?v=4" width="100;" alt="thegeekyb0y"/>
<br />
<sub><b>Aditya Tiwari</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/BassCoder2808">
<img src="https://avatars.githubusercontent.com/u/65075935?v=4" width="100;" alt="BassCoder2808"/>
@ -367,13 +374,21 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Mayuri Kolhe</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/theadeyemiolayinka">
<img src="https://avatars.githubusercontent.com/u/64863320?v=4" width="100;" alt="theadeyemiolayinka"/>
<br />
<sub><b>Olayinka Adeyemi</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/parinzee">
<img src="https://avatars.githubusercontent.com/u/30139280?v=4" width="100;" alt="parinzee"/>
<br />
<sub><b>Parinthapat P.</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/iamrahul8">
<img src="https://avatars.githubusercontent.com/u/72541381?v=4" width="100;" alt="iamrahul8"/>
@ -387,8 +402,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Sayan Roy</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/Tanya-1109">
<img src="https://avatars.githubusercontent.com/u/107848751?v=4" width="100;" alt="Tanya-1109"/>
@ -396,6 +410,13 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Tanya Mohanka</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/YashIndane">
<img src="https://avatars.githubusercontent.com/u/53041219?v=4" width="100;" alt="YashIndane"/>
<br />
<sub><b>Yash Indane</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/ambushneupane">
<img src="https://avatars.githubusercontent.com/u/56769633?v=4" width="100;" alt="ambushneupane"/>
@ -409,7 +430,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Aswin Shailajan</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/jrafaaael">
<img src="https://avatars.githubusercontent.com/u/70046023?v=4" width="100;" alt="jrafaaael"/>
@ -430,8 +452,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Aarya Chopkar</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/aimanaisha">
<img src="https://avatars.githubusercontent.com/u/94171436?v=4" width="100;" alt="aimanaisha"/>
@ -452,7 +473,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Arijit Ghosh</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Danuragtiwari">
<img src="https://avatars.githubusercontent.com/u/86867000?v=4" width="100;" alt="Danuragtiwari"/>
@ -473,8 +495,14 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Gokul_Zuzu</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/KuSantosh100">
<img src="https://avatars.githubusercontent.com/u/97560663?v=4" width="100;" alt="KuSantosh100"/>
<br />
<sub><b>KUMAR SANTOSH</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Manice18">
<img src="https://avatars.githubusercontent.com/u/91601706?v=4" width="100;" alt="Manice18"/>
@ -488,7 +516,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Null</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/LEO1612D">
<img src="https://avatars.githubusercontent.com/u/46849277?v=4" width="100;" alt="LEO1612D"/>
@ -516,8 +545,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Riya Jaiswal</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/sarthakroy2002">
<img src="https://avatars.githubusercontent.com/u/47187468?v=4" width="100;" alt="sarthakroy2002"/>
@ -531,7 +559,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Shreejan Dolai</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Tejaswi-Kumar">
<img src="https://avatars.githubusercontent.com/u/67323842?v=4" width="100;" alt="Tejaswi-Kumar"/>
@ -559,8 +588,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Arpit Bhardwaj</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/artemis-i-guess">
<img src="https://avatars.githubusercontent.com/u/65388018?v=4" width="100;" alt="artemis-i-guess"/>
@ -574,7 +602,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Null</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/codeswithroh">
<img src="https://avatars.githubusercontent.com/u/77570394?v=4" width="100;" alt="codeswithroh"/>
@ -602,8 +631,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Michele Mazza</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/mer747">
<img src="https://avatars.githubusercontent.com/u/84189502?v=4" width="100;" alt="mer747"/>
@ -611,6 +639,14 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/MubeenAhmad571">
<img src="https://avatars.githubusercontent.com/u/56739319?v=4" width="100;" alt="MubeenAhmad571"/>
<br />
<sub><b>Mubeen Ahmad</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/nabroleonx">
<img src="https://avatars.githubusercontent.com/u/84567489?v=4" width="100;" alt="nabroleonx"/>

View File

@ -0,0 +1,10 @@
## Caeser Cipher files ADDED #348
## Caeser Cipher
Easilly Generate Caecer Cipher equivalent for any text
## Installation
- Clone the repo
- download the requirements
- run `python cc.py`

View File

@ -0,0 +1,62 @@
# @author https://github.com/theadeyemiolayinka
from statistics import mode
class Caesar():
def __init__(self):
self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
self.translated = ''
def __crypt(self, mode):
for symbol in self.message.upper():
if symbol in self.LETTERS:
num = self.LETTERS.find(symbol)
if mode == 'encrypt':
num = num + self.key
elif mode == 'decrypt':
num = num - self.key
if num >= len(self.LETTERS):
num = num - len(self.LETTERS)
elif num < 0:
num = num + len(self.LETTERS)
self.translated = self.translated + self.LETTERS[num]
else:
self.translated = self.translated + symbol
return self.translated
def encrypt(self, message, key=0):
self.translated = ''
self.key = key
self.message = message
return self.__crypt('encrypt')
def decrypt(self, message, key=0):
self.translated = ''
self.key = key
self.message = message
return self.__crypt('decrypt')
def invokeCipher(cipher, key, text, e_mode):
if e_mode == 'E' or e_mode == 'e':
print('\n====================RESULT====================')
return cipher.encrypt(text, key)
elif e_mode == 'D' or e_mode == 'd':
print('\n====================RESULT====================')
return cipher.decrypt(text, key)
else:
print('Ivalid mode.')
n_mode = str(input("Enter mode: [E] for encryption and [D] for decryption:\n>"))
return invokeCipher(cipher, key, text, n_mode)
cipher = Caesar()
key = int(input('Enter encryption key:\n>'))
text = str(input('Enter text:\n>'))
e_mode = str(input("Enter mode: [E] for encryption and [D] for decryption:\n>"))
print(invokeCipher(cipher, key, text, e_mode))
print('==============================================')

View File

@ -0,0 +1,25 @@
The function makes a labelled confusion matrix comparing predictions and ground truth labels.
If classes is passed, confusion matrix will be labelled, if not, integer class values will be used.
Args:
* `y_true`: Array of truth labels (must be same shape as y_pred).
* `y_pred`: Array of predicted labels (must be same shape as y_true).
* `classes`: Array of class labels (e.g. string form). If `None`, integer labels are used.
* `figsize`: Size of output figure (default=(10, 10)).
* `text_size`: Size of output figure text (default=15).
* `norm`: normalize values or not (default=False).
* `savefig`: save confusion matrix to file (default=False).
Returns: A labelled confusion matrix plot comparing y_true and y_pred.
### Example usage:
> """make_confusion_matrix(y_true=test_labels, # ground truth test labels
y_pred=y_preds, # predicted labels
classes=class_names, # array of class label names
figsize=(15, 15),
text_size=10)"""
#### CODE BY ZeroToMastery TensorFlow course.

View File

@ -0,0 +1,54 @@
import itertools
import matplotlib.pyplot as plt
import numpy as np
from sklearn.metrics import confusion_matrix
def make_confusion_matrix(y_true, y_pred, classes=None, figsize=(10, 10), text_size=15, norm=False, savefig=False):
# Create the confustion matrix
cm = confusion_matrix(y_true, y_pred)
cm_norm = cm.astype("float") / cm.sum(axis=1)[:, np.newaxis] # normalize it
n_classes = cm.shape[0] # find the number of classes we're dealing with
# Plot the figure and make it pretty
fig, ax = plt.subplots(figsize=figsize)
cax = ax.matshow(cm, cmap=plt.cm.Blues) # colors will represent how 'correct' a class is, darker == better
fig.colorbar(cax)
# Are there a list of classes?
if classes:
labels = classes
else:
labels = np.arange(cm.shape[0])
# Label the axes
ax.set(title="Confusion Matrix",
xlabel="Predicted label",
ylabel="True label",
xticks=np.arange(n_classes), # create enough axis slots for each class
yticks=np.arange(n_classes),
xticklabels=labels, # axes will labeled with class names (if they exist) or ints
yticklabels=labels)
# Make x-axis labels appear on bottom
ax.xaxis.set_label_position("bottom")
ax.xaxis.tick_bottom()
# Set the threshold for different colors
threshold = (cm.max() + cm.min()) / 2.
# Plot the text on each cell
for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])):
if norm:
plt.text(j, i, f"{cm[i, j]} ({cm_norm[i, j]*100:.1f}%)",
horizontalalignment="center",
color="white" if cm[i, j] > threshold else "black",
size=text_size)
else:
plt.text(j, i, f"{cm[i, j]}",
horizontalalignment="center",
color="white" if cm[i, j] > threshold else "black",
size=text_size)
# Save the figure to the current working directory
if savefig:
fig.savefig("confusion_matrix.png")

View File

@ -0,0 +1,54 @@
from tkinter import *
from tkinter import messagebox
from PyDictionary import PyDictionary
root = Tk()
root.title("GUI Dictionary")
root.geometry("500x400")
dictionary = PyDictionary()
def getMeaning():
response = dictionary.meaning(word.get())
if (response):
if ('Noun' in response):
meaning = response['Noun'][0]
elif ('Verb' in response):
meaning = response['Verb'][0]
elif ('Adjective' in response):
meaning = response['Adjective'][0]
else:
meaning = "Invalid word"
else:
messagebox.showinfo(
"Error", "Please add a Noun, Pronoun, verb or a valid word.")
meaning_label.config(text=meaning)
heading_label = Label(root, text="DICTIONARY", font=("Times 35 bold"), foreground='dark blue')
heading_label.config(anchor=CENTER)
heading_label.pack(pady=10)
frame = Frame(root)
Label(frame, text="Enter Word", font=("Helvetica 15 bold"), foreground='dodger blue').pack(side=LEFT)
word = Entry(frame, font=("Helvetica 15 bold"))
word.pack(padx=10)
frame.pack()
search_button = Button(root, text="Search Word", font=("arial 15 bold"), relief=RIDGE, borderwidth=3, cursor="hand2", foreground='Magenta', command=getMeaning)
search_button.config(anchor=CENTER)
search_button.pack(pady=10)
frame1 = Frame(root)
Label(frame1, text="Meaning : ", font=("Helvetica 15 bold"), foreground='medium turquoise').pack(side=LEFT)
meaning_label = Label(frame1, text="", font=("Helvetica 12"))
meaning_label.pack(pady=5)
frame1.pack(pady=10)
root.mainloop()

View File

@ -0,0 +1,24 @@
# Dictionary GUI
This script lets the user search for the meaning of words like a dictionary.
## Setup instructions
In order to run this script, you need to have Python and pip installed on your system. After you're done installing Python and pip, run the following command from your terminal to install the requirements for the project.
```
pip install PyDictionary
```
After satisfying all the requirements for the project, Open the terminal in the project folder and run
```
python GUI_Dictionary.py
```
or
```
python3 GUI_Dictionary.py
```
depending upon the python version. Make sure that you are running the command from the same virtual environment in which the required modules are installed.
# Introducing to Interface
<img src="screenshots/gui_dict1.png">
<br>
<img src="screenshots/gui-dict-3.png"><br>
<img src="screenshots/gui-dict-4.png">

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -0,0 +1,2 @@
This is a Sudoku Solver that uses backtracking algorithm to solve the puzzle.
Input the puzzle from command line.

View File

@ -0,0 +1,83 @@
import numpy as np
problem = []
for x in range(9):
i = input()
l = [int(v) for v in i]
problem.append(l)
#print(problem)
np_problem = np.array(problem)
fixed_coordinates = [] # first getting the coordinates where fixed numbers are present
empty_coordinates = []
for i , sub_array in enumerate(problem) :
temp = [[i , c] for c , sub_element in enumerate(sub_array) if sub_element > 0]
temp2 = [[i , j] for j , sub_element2 in enumerate(sub_array) if sub_element2 == 0]
for z in temp : fixed_coordinates.append(z)
for w in temp2 : empty_coordinates.append(w)
l , m , r = [0 , 3 , 6] , [1 , 4 , 7] , [2 , 5 , 8]
avoid_dict = {idx : [] for idx in list(range(0 , len(empty_coordinates)))}
def generate_bounds(r , c) -> list:
lower_bound_c = c if c in l else c - 1 if c in m else c - 2
upper_bound_c = c + 3 if c in l else c + 2 if c in m else c + 1
lower_bound_r = r if r in l else r - 1 if r in m else r - 2
upper_bound_r = r + 3 if r in l else r + 2 if r in m else r + 1
return [lower_bound_c , upper_bound_c , lower_bound_r , upper_bound_r]
def backtrack(return_coordinates) :
n_r , n_c = empty_coordinates[empty_coordinates.index(return_coordinates) - 1] # getting back element coordinates
while [n_r , n_c] != empty_coordinates[empty_coordinates.index(return_coordinates) + 1]:
if np_problem[n_r , n_c] != 0 :
avoid_dict[empty_coordinates.index([n_r , n_c])].append(np_problem[n_r , n_c])
fix_flag = False
r , c = n_r , n_c
for num in range(1 , 10) :
l_b_c , u_b_c , l_b_r , u_b_r = generate_bounds(r , c)
if all([num not in np_problem[l_b_r : u_b_r , l_b_c : u_b_c] , num not in np_problem[r , :] , num not in np_problem[: , c]]) :
if num not in avoid_dict.get(empty_coordinates.index([n_r , n_c])) :
np_problem[n_r , n_c] , fix_flag = num , True
break
if fix_flag : n_r , n_c = empty_coordinates[empty_coordinates.index([n_r , n_c]) + 1]
if not fix_flag :
np_problem[n_r , n_c] = 0
avoid_dict[empty_coordinates.index([n_r , n_c])].clear()
n_r , n_c = empty_coordinates[empty_coordinates.index([n_r , n_c]) - 1]
for r in range(9) :
for c in range(9) :
if [r , c] not in fixed_coordinates :
fix_flag = False
for num in range(1 , 10) :
l_b_c , u_b_c , l_b_r , u_b_r = generate_bounds(r , c)
if all([num not in np_problem[l_b_r : u_b_r , l_b_c : u_b_c] , num not in np_problem[r , :] , num not in np_problem[: , c]]) :
np_problem[r , c] , fix_flag = num , True
break
if not fix_flag : backtrack([r , c])
print(np_problem)

View File

@ -0,0 +1,25 @@
import os,requests
from win10toast import ToastNotifier
from dotenv import load_dotenv
load_dotenv()
n = ToastNotifier()
city = input("Enter city name: ")
url = "https://api.openweathermap.org/data/2.5/weather?q="+city+"&appid="+os.getenv("API_key")+"&units=metric"
r = requests.get(url,auth= (os.getenv("user"),os.getenv("password")))
r_dict = r.json()
current_temp = r_dict['main']['temp']
weather_desc = r_dict['weather'][0]['description']
temp = (str(current_temp))
desc = str(weather_desc)
result = "Current temperature is: " + temp + " Celsius in " + city+ ".\nCurrent weather condition is: " + desc
n.show_toast("Live Weather update: ",
result, duration = 10)