From f01efe20c1a0892be6f0832d9fa9c77b638dbd65 Mon Sep 17 00:00:00 2001 From: Mitesh <46081187+Mitesh2499@users.noreply.github.com> Date: Tue, 23 Jun 2020 21:54:13 +0530 Subject: [PATCH 1/3] Add files via upload --- .../random_password_gen.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/Random password generator/random_password_gen.py diff --git a/projects/Random password generator/random_password_gen.py b/projects/Random password generator/random_password_gen.py new file mode 100644 index 00000000..42510dff --- /dev/null +++ b/projects/Random password generator/random_password_gen.py @@ -0,0 +1,42 @@ +import random +import math +alpha = "abcdefghijklmnopqrstuvwxyz" +num = "0123456789" +special = "@#$%&*" + +# pass_len=random.randint(8,13) #without User INput +pass_len = int(input("Enter Password Length")) + +# length of password by 50-30-20 formula +alpha_len = pass_len//2 +num_len = math.ceil(pass_len*30/100) +special_len = pass_len-(alpha_len+num_len) + + +password = [] + + +def generate_pass(length, array, is_alpha=False): + for i in range(length): + index = random.randint(0, len(array) - 1) + character = array[index] + if is_alpha: + case = random.randint(0, 1) + if case == 1: + character = character.upper() + password.append(character) + + +# alpha password +generate_pass(alpha_len, alpha, True) +# numeric password +generate_pass(num_len, num) +# special Character password +generate_pass(special_len, special) +# suffle the generated password list +random.shuffle(password) +# convert List To string +gen_password = "" +for i in password: + gen_password = gen_password + str(i) +print(gen_password) From e9e5fffab99f272120134576dc4b86401363ea58 Mon Sep 17 00:00:00 2001 From: Mitesh <46081187+Mitesh2499@users.noreply.github.com> Date: Tue, 23 Jun 2020 22:06:27 +0530 Subject: [PATCH 2/3] Add files via upload --- projects/battery notification/battery.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/battery notification/battery.py diff --git a/projects/battery notification/battery.py b/projects/battery notification/battery.py new file mode 100644 index 00000000..30700e95 --- /dev/null +++ b/projects/battery notification/battery.py @@ -0,0 +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() From 38a010c71a8d58154d9b3d1fc5568ef22a96d629 Mon Sep 17 00:00:00 2001 From: Mitesh <46081187+Mitesh2499@users.noreply.github.com> Date: Thu, 25 Jun 2020 18:58:59 +0530 Subject: [PATCH 3/3] Add files via upload --- .../files/file1.txt | 2 ++ .../files/file2.txt | 1 + .../files/file3.txt | 1 + .../files/folder1/hello.txt | 1 + .../files/folder1/python.txt | 2 ++ .../findstring.py | 33 +++++++++++++++++++ 6 files changed, 40 insertions(+) create mode 100644 projects/string search from multiple files/files/file1.txt create mode 100644 projects/string search from multiple files/files/file2.txt create mode 100644 projects/string search from multiple files/files/file3.txt create mode 100644 projects/string search from multiple files/files/folder1/hello.txt create mode 100644 projects/string search from multiple files/files/folder1/python.txt create mode 100644 projects/string search from multiple files/findstring.py diff --git a/projects/string search from multiple files/files/file1.txt b/projects/string search from multiple files/files/file1.txt new file mode 100644 index 00000000..a4271094 --- /dev/null +++ b/projects/string search from multiple files/files/file1.txt @@ -0,0 +1,2 @@ +this is file one +this is file one this is file one this is file one this is file one this is file one this is file one \ No newline at end of file diff --git a/projects/string search from multiple files/files/file2.txt b/projects/string search from multiple files/files/file2.txt new file mode 100644 index 00000000..25d43756 --- /dev/null +++ b/projects/string search from multiple files/files/file2.txt @@ -0,0 +1 @@ +this is file two \ No newline at end of file diff --git a/projects/string search from multiple files/files/file3.txt b/projects/string search from multiple files/files/file3.txt new file mode 100644 index 00000000..869e86a8 --- /dev/null +++ b/projects/string search from multiple files/files/file3.txt @@ -0,0 +1 @@ +this is file three \ No newline at end of file diff --git a/projects/string search from multiple files/files/folder1/hello.txt b/projects/string search from multiple files/files/folder1/hello.txt new file mode 100644 index 00000000..ed253a76 --- /dev/null +++ b/projects/string search from multiple files/files/folder1/hello.txt @@ -0,0 +1 @@ +this is hello world \ No newline at end of file diff --git a/projects/string search from multiple files/files/folder1/python.txt b/projects/string search from multiple files/files/folder1/python.txt new file mode 100644 index 00000000..e4d1b6f8 --- /dev/null +++ b/projects/string search from multiple files/files/folder1/python.txt @@ -0,0 +1,2 @@ +this is python file +learn python \ No newline at end of file diff --git a/projects/string search from multiple files/findstring.py b/projects/string search from multiple files/findstring.py new file mode 100644 index 00000000..9f8f0445 --- /dev/null +++ b/projects/string search from multiple files/findstring.py @@ -0,0 +1,33 @@ +import os + +text = input("input text : ") + +path = input("path : ") + +# os.chdir(path) + + +def getfiles(path): + f = 0 + os.chdir(path) + files = os.listdir() + # print(files) + for file_name in files: + abs_path = os.path.abspath(file_name) + if os.path.isdir(abs_path): + getfiles(abs_path) + if os.path.isfile(abs_path): + f = open(file_name, "r") + if text in f.read(): + f = 1 + print(text + " found in ") + final_path = os.path.abspath(file_name) + print(final_path) + return True + + if f == 1: + print(text + " not found! ") + return False + + +getfiles(path)