Skip to content
Open
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
4 changes: 2 additions & 2 deletions Day-04/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ In this example, we import the `math` module and then use functions and variable

Python workspaces refer to the environment in which you develop and run your Python code. They include the Python interpreter, installed libraries, and the current working directory. Understanding workspaces is essential for managing dependencies and code organization.

Python workspaces can be local or virtual environments. A local environment is the system-wide Python installation, while a virtual environment is an isolated environment for a specific project. You can create virtual environments using tools like `virtualenv` or `venv`.
Python workspaces can be local or virtual environments. A local environment is the system-wide Python installation, while a virtual environment is an isolated environment for a specific project. You can create virtual environments using tools like `virtualenv` or `venv`.(logical seperation for python packages on virtual machine).

**Example:**

Expand All @@ -111,4 +111,4 @@ myenv\Scripts\activate
source myenv/bin/activate
```

Once activated, you work in an isolated workspace with its Python interpreter and library dependencies.
Once activated, you work in an isolated workspace with its Python interpreter and library dependencies.
33 changes: 33 additions & 0 deletions Day-04/calc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import sys
import os


def add(num1,num2):
add = num1 + num2
return add

def sub(num1, num2):
sub = num1 - num2
return sub

def mul(num1, num2):
m = num1 * num2
return m

num1= float(sys.argv[1])
operation = sys.argv[2]
num2 = float(sys.argv[3])

if operation=='add':
output=add(num1,num2)
print(output)

if operation =='sub':
output=sub(num1,num2)
print(output)

if operation =='mul':
output=mul(num1,num2)
print(output)

print(os.getenv("password"))
65 changes: 65 additions & 0 deletions Day-06/02-Assignment/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#a=3
#b=4

#sum=a+b
#difference=a-b
#product=a*b
#quotient=a/b
#modulus=a%b
#exponentiation=a**b
#floor_division=a//b

#greater=a>b
#less=a<b
#greater_equal=a>=b
#less_equal=a<=b
#equal=a==b
#not_equal=a!=b

#x=True
#y=False

#and_1=x and y
#or_1=x or y
#not_1= not y
#not_2= not x

#total =10

#total +=4
#total -=7
#total *=8
#total /=2

#print("Sum of function is=",sum)
#print("difference of function is=",difference)
#print("product of function is=",product)
#print("quotient of function is=",quotient)
#print("modulus of function is=",modulus)
#print("exponentiation of function is=",exponentiation)
#print("floor division of function is=",floor_division)

#print("Greater than function is=",greater)
#print("Less than function is=",less)
#print("Greater than or equal to function is=",greater_equal)
#print("Less than or equal to function is=",less_equal)
#print("Equal to function is=",equal)
#print("Not equal to function is=",not_equal)

#print("Logical and is", and_1)
#print("Logical or is", or_1)
#print("Logical not is", not_1 )
#print("Logical not is", not_2 )

#print("final value of total is=",total)

#my_list=["apple","grapes","rabbit",1,2,3,4]
#u="apple"

#b="grapes"
#c="banana"

#print(u is u)
#print(u is not my_list)
#print(b in my_list)
#print(c not in my_list)
11 changes: 11 additions & 0 deletions Day-07/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys
type= sys.argv[1]

if type=="t2.micro":
print("charges are 2 dollar/tb data transfer")
elif type=="t2.medium":
print("charges are 8 dollar/tb data transfer")
elif type=="t2.xlarge":
print("charges are 10 dollar/tb data transfer")
else:
print("wrong type of instance provided")
10 changes: 10 additions & 0 deletions Day-09/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
log_file = [
"INFO: Operation successful",
"ERROR: line 43-File not found",
"DEBUG: Connection established",
"ERROR: port-4385 Database connection failed",
]

for line in log_file:
if "ERROR" in line:
print(line)
30 changes: 30 additions & 0 deletions Day-09/test1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

servers=("server1" "server2" "server3")
for server in "${servers[@]}"; do
configure_monitoring_agent "$server"
done

environments=("dev" "staging" "prod")
for env in "${environments[@]}"; do
deploy_configuration "$env"
done

databases=("db1" "db2" "db3")
for db in "${databases[@]}"; do
create_backup "$db"
done

log_files=("app.log" "access.log" "error.log")
for log_file in "${log_files[@]}"; do
rotate_and_cleanup_logs "$log_file"
done

servers=("server1" "server2" "server3")
for server in "${servers[@]}"; do
check_resource_utilization "$server"
done

servers=("server1" "server2" "server3")
for server in "${servers[@]}"; do
check_resource_utilization "$server"
done
31 changes: 31 additions & 0 deletions Day-09/test2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
servers=("server1" "server2" "server3")
for server in "${servers[@]}"; do
check_resource_utilization "$server"
done

while ! aws ec2 describe-instance-status --instance-ids i-1234567890abcdef0 | grep -q "running"; do
echo "Waiting for the EC2 instance to be running..."
sleep 10
done

while true; do
if tail -n 1 /var/log/app.log | grep -q "ERROR"; then
send_alert "Error detected in the log."
fi
sleep 5
done

while true; do
replication_lag=$(mysql -e "SHOW SLAVE STATUS\G" | grep "Seconds_Behind_Master" | awk '{print $2}')
if [ "$replication_lag" -gt 60 ]; then
trigger_data_sync
fi
sleep 60
done

while true; do
if ! check_service_health; then
restart_service
fi
sleep 30
done
28 changes: 28 additions & 0 deletions Day-10/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os

def list_files_in_folder(folder_path):
try:
files=os.listdir(folder_path)
return files, None
except FileNotFoundError:
return None, "folder not found"
except PermissionError:
return None, "persmission denied"


def main():
folder_paths= input("Enter folder paths seperated by space:").split()

for folder_path in folder_paths:
files, error_message=list_files_in_folder(folder_path)
if files:
print(f"files in {folder_path}")
for file in files:
print(file)

else:
print(f"error in folder {folder_path}: {error_message}")

if __name__=="__main__":
main()

9 changes: 9 additions & 0 deletions Day-11/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import requests

response= requests.get("https://api.github.com/repos/kubernetes/kubernetes/pulls")

complete_detail = response.json()

for i in range(len(complete_detail)):
print(complete_detail[i])

2 changes: 1 addition & 1 deletion Day-12/server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Network Settings
PORT = 8080
MAX_CONNECTIONS=600
MAX_CONNECTIONS=1000
TIMEOUT = 30

# Security Settings
Expand Down
13 changes: 13 additions & 0 deletions Day-12/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def update_server_config(file_path, key, value):

with open(file_path,"r") as file:
lines=file.readlines()

with open(file_path,"w") as file:
for line in lines:
if key in line:
file.write(key + "=" + value + "\n")
else:
file.write(line)

update_server_config("server.conf", "MAX_CONNECTIONS","1000")