Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.
Closed
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
42 changes: 42 additions & 0 deletions projects/Random password generator/random_password_gen.py
Original file line number Diff line number Diff line change
@@ -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)
19 changes: 19 additions & 0 deletions projects/battery notification/battery.py
Original file line number Diff line number Diff line change
@@ -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()
2 changes: 2 additions & 0 deletions projects/string search from multiple files/files/file1.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions projects/string search from multiple files/files/file2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is file two
1 change: 1 addition & 0 deletions projects/string search from multiple files/files/file3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is file three
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is hello world
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
this is python file
learn python
33 changes: 33 additions & 0 deletions projects/string search from multiple files/findstring.py
Original file line number Diff line number Diff line change
@@ -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)