diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index ecdc784..56a835c 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -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 ) diff --git a/README.md b/README.md index a0dd525..5e16a52 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,21 @@ Thanks a lot for spending your time helping! Keep rocking 🍻 Mohd Afzal Khan + + + MSVelan +
+ Null +
+ + + + rahulkarda +
+ Rahul Karda +
+ + kriptonian1 @@ -215,8 +230,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Sourodip Kar
- - + varunKT001 @@ -244,7 +258,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Dishant Nagpal
- + + Kunalp02 @@ -258,8 +273,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Mysterious-Owl
- - + PritamP20 @@ -267,13 +281,6 @@ Thanks a lot for spending your time helping! Keep rocking 🍻 Null - - - rahulkarda -
- Rahul Karda -
- Tiagupt03 @@ -294,15 +301,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Drk1rd
- + + lordvader501
Null
- - + rohitgarud21 @@ -337,15 +344,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Nishant Pacharne
- + + thegeekyb0y
Aditya Tiwari
- - + BassCoder2808 @@ -367,13 +374,21 @@ Thanks a lot for spending your time helping! Keep rocking 🍻 Mayuri Kolhe + + + theadeyemiolayinka +
+ Olayinka Adeyemi +
+ parinzee
Parinthapat P.
- + + iamrahul8 @@ -387,8 +402,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Sayan Roy
- - + Tanya-1109 @@ -396,6 +410,13 @@ Thanks a lot for spending your time helping! Keep rocking 🍻 Tanya Mohanka + + + YashIndane +
+ Yash Indane +
+ ambushneupane @@ -409,7 +430,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Aswin Shailajan
- + + jrafaaael @@ -430,8 +452,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Aarya Chopkar
- - + aimanaisha @@ -452,7 +473,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Arijit Ghosh
- + + Danuragtiwari @@ -473,8 +495,14 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Gokul_Zuzu
- - + + + + KuSantosh100 +
+ KUMAR SANTOSH +
+ Manice18 @@ -488,7 +516,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Null
- + + LEO1612D @@ -516,8 +545,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Riya Jaiswal
- - + sarthakroy2002 @@ -531,7 +559,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Shreejan Dolai
- + + Tejaswi-Kumar @@ -559,8 +588,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Arpit Bhardwaj
- - + artemis-i-guess @@ -574,7 +602,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Null
- + + codeswithroh @@ -602,8 +631,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Michele Mazza
- - + mer747 @@ -611,6 +639,14 @@ Thanks a lot for spending your time helping! Keep rocking 🍻 Null + + + MubeenAhmad571 +
+ Mubeen Ahmad +
+ + nabroleonx diff --git a/scripts/Caeser_Cipher_sage/README.md b/scripts/Caeser_Cipher_sage/README.md new file mode 100644 index 0000000..69da04a --- /dev/null +++ b/scripts/Caeser_Cipher_sage/README.md @@ -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` diff --git a/scripts/Caeser_Cipher_sage/cc.py b/scripts/Caeser_Cipher_sage/cc.py new file mode 100644 index 0000000..9bb3224 --- /dev/null +++ b/scripts/Caeser_Cipher_sage/cc.py @@ -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('==============================================') diff --git a/scripts/Confusion_Matrix/README.md b/scripts/Confusion_Matrix/README.md new file mode 100644 index 0000000..30c0c4f --- /dev/null +++ b/scripts/Confusion_Matrix/README.md @@ -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. diff --git a/scripts/Confusion_Matrix/make_confusion_matrix.py b/scripts/Confusion_Matrix/make_confusion_matrix.py new file mode 100644 index 0000000..635e723 --- /dev/null +++ b/scripts/Confusion_Matrix/make_confusion_matrix.py @@ -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") \ No newline at end of file diff --git a/scripts/GUI_Dictionary/GUI_Dictionary.py b/scripts/GUI_Dictionary/GUI_Dictionary.py new file mode 100644 index 0000000..58a8fd6 --- /dev/null +++ b/scripts/GUI_Dictionary/GUI_Dictionary.py @@ -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() \ No newline at end of file diff --git a/scripts/GUI_Dictionary/README.md b/scripts/GUI_Dictionary/README.md new file mode 100644 index 0000000..9e16c77 --- /dev/null +++ b/scripts/GUI_Dictionary/README.md @@ -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 + +
+
+ \ No newline at end of file diff --git a/scripts/GUI_Dictionary/screenshots/gui-dict-3.png b/scripts/GUI_Dictionary/screenshots/gui-dict-3.png new file mode 100644 index 0000000..b4d9c08 Binary files /dev/null and b/scripts/GUI_Dictionary/screenshots/gui-dict-3.png differ diff --git a/scripts/GUI_Dictionary/screenshots/gui-dict-4.png b/scripts/GUI_Dictionary/screenshots/gui-dict-4.png new file mode 100644 index 0000000..cb6cd05 Binary files /dev/null and b/scripts/GUI_Dictionary/screenshots/gui-dict-4.png differ diff --git a/scripts/GUI_Dictionary/screenshots/gui_dict1.png b/scripts/GUI_Dictionary/screenshots/gui_dict1.png new file mode 100644 index 0000000..f5c2585 Binary files /dev/null and b/scripts/GUI_Dictionary/screenshots/gui_dict1.png differ diff --git a/scripts/Sudoku-Solver/README.md b/scripts/Sudoku-Solver/README.md new file mode 100644 index 0000000..bea82a2 --- /dev/null +++ b/scripts/Sudoku-Solver/README.md @@ -0,0 +1,2 @@ +This is a Sudoku Solver that uses backtracking algorithm to solve the puzzle. +Input the puzzle from command line. diff --git a/scripts/Sudoku-Solver/main.py b/scripts/Sudoku-Solver/main.py new file mode 100644 index 0000000..11fca12 --- /dev/null +++ b/scripts/Sudoku-Solver/main.py @@ -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) diff --git a/scripts/Weather_Notifications_Desktop/weather_Notifications_Desktop.py b/scripts/Weather_Notifications_Desktop/weather_Notifications_Desktop.py new file mode 100644 index 0000000..6439501 --- /dev/null +++ b/scripts/Weather_Notifications_Desktop/weather_Notifications_Desktop.py @@ -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)