Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
keshavsingh4522 authored Oct 17, 2020
2 parents 13f303e + 5c8eaca commit 8cb7ff4
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@
| Ankit Sharma | [@ANKITSHARMA98](https://github.com/ANKITSHARMA98) |
| Nikhil Sachan | [@nikhil254](https://github.com/nikhil254) |
| Ritik Bagora | [@ritik1999](https://github.com/ritik1999) |
| B Rahul | [@rahulbollisetty](https://github.com/rahulbollisetty) |
| Raghav Agarwal | [@ragharwal](https://github.com/ragharwal) |
| Ananya Sharma | [@AnanyaSharma22](https://github.com/AnanyaSharma22) |
| Tanmay Khandelwal | [@Dude-901](https://github.com/Dude-901) |
| B Rahul | [@rahulbollisetty](https://github.com/rahulbollisetty) |
42 changes: 42 additions & 0 deletions Python/palindrome_partition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#palindrome_partition

#Method to check whether the string is palindrome or not
def isPalindrome(string:str, start:int, end:int):
while start < end:
if string[end] != string[start]:
return False
start += 1
end -= 1
return True

#Recursive method to search for all the possible partitions.
def findAllPartitions(allPartitions, subPartitions, initial, n, string):
if initial >= n:
x = subPartitions.copy()
allPartitions.append(x)
return

for i in range(initial, n):
if isPalindrome(string, initial, i):

subPartitions.append(string[initial:i + 1])

findAllPartitions(allPartitions, subPartitions, i + 1, n, string)

subPartitions.pop()

#Method to print all the possible palindrome partitions.
def palindromePartitions(string):
allPartitions = []
subPartitions = []

findAllPartitions(allPartitions, subPartitions, 0, len(string), string)

for i in enumerate(allPartitions):
for j in enumerate(allPartitions[i[0]]):
print(allPartitions[i[0]][j[0]], end = " ")
print()

#Take a string input
string = str(input())
palindromePartitions(string)
28 changes: 28 additions & 0 deletions pc_health_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Check pc health status
# For a stable system,
# free space should be > 20% and,
# disk usage should be < 75%

# pip install psutil

import shutil
import psutil


def check_disk_usage(disk):
du = shutil.disk_usage(disk)
free = du.free / du.total * 100
return free


def check_cpu_usage():
usage = psutil.cpu_percent(1)
return usage


a = check_disk_usage("/")
b = check_cpu_usage()
if a > 20 or b < 75:
print("Pc is stable \nfree space: {:.2f}% \nCPU usage: {:.2f}%".format(a,b))
else:
print("Error!!!\nAction required \nfree space: {:.2f}% \nCPU usage: {:.2f}%".format(a, b))

0 comments on commit 8cb7ff4

Please sign in to comment.