From bf629d8d68d008c21abb5a0831bce4ad6a9dba3f Mon Sep 17 00:00:00 2001 From: Sumit Suman Date: Tue, 10 Mar 2026 16:01:38 +0530 Subject: [PATCH 1/2] Implement duplicate file finder using SHA256 hashing --- duplicate_file_finder.py | 49 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 duplicate_file_finder.py diff --git a/duplicate_file_finder.py b/duplicate_file_finder.py new file mode 100644 index 00000000000..0bbf30267ff --- /dev/null +++ b/duplicate_file_finder.py @@ -0,0 +1,49 @@ +import os +import hashlib + + +def hash_file(filepath): + """Return SHA256 hash of file""" + h = hashlib.sha256() + with open(filepath, 'rb') as f: + while chunk := f.read(8192): + h.update(chunk) + return h.hexdigest() + + +def find_duplicates(directory): + hashes = {} + duplicates = [] + + for root, dirs, files in os.walk(directory): + for file in files: + path = os.path.join(root, file) + try: + file_hash = hash_file(path) + + if file_hash in hashes: + duplicates.append((path, hashes[file_hash])) + else: + hashes[file_hash] = path + + except Exception as e: + print(f"Error reading {path}: {e}") + + return duplicates + + +if __name__ == "__main__": + directory = input("Enter directory to scan: ") + + if not os.path.isdir(directory): + print("Invalid directory") + exit() + + duplicates = find_duplicates(directory) + + if not duplicates: + print("No duplicate files found.") + else: + print("\nDuplicate files:") + for dup, original in duplicates: + print(f"{dup} == {original}") From d7d05c5319e7d61d51ee35db4287d7ed070821fa Mon Sep 17 00:00:00 2001 From: Sumit Suman Date: Tue, 10 Mar 2026 16:07:14 +0530 Subject: [PATCH 2/2] Add typing speed test functionality --- typing_speed_test.py | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 typing_speed_test.py diff --git a/typing_speed_test.py b/typing_speed_test.py new file mode 100644 index 00000000000..e10eb89fff1 --- /dev/null +++ b/typing_speed_test.py @@ -0,0 +1,51 @@ +import time +import random + +sentences = [ + "Python is a powerful and easy to learn programming language.", + "Open source software encourages collaboration and innovation.", + "Practice coding every day to improve your programming skills.", + "Automation can save time and reduce repetitive work.", + "Git and GitHub are essential tools for developers.", + "Clean code is easier to read and maintain.", + "Debugging is an important part of the development process.", +] + +def calculate_wpm(text, elapsed_time): + words = len(text.split()) + minutes = elapsed_time / 60 + return round(words / minutes) + +def typing_test(): + sentence = random.choice(sentences) + + print("\nTyping Speed Test\n") + print("Type the following sentence:\n") + print(sentence) + input("\nPress ENTER when you are ready...") + + start_time = time.time() + + typed = input("\nStart typing:\n") + + end_time = time.time() + + elapsed_time = end_time - start_time + + correct_chars = 0 + for i in range(min(len(sentence), len(typed))): + if sentence[i] == typed[i]: + correct_chars += 1 + + accuracy = (correct_chars / len(sentence)) * 100 + + wpm = calculate_wpm(typed, elapsed_time) + + print("\nResults") + print("-------") + print(f"Time taken: {round(elapsed_time,2)} seconds") + print(f"Typing speed: {wpm} WPM") + print(f"Accuracy: {round(accuracy,2)} %") + +if __name__ == "__main__": + typing_test()