This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
ec2_client = boto3.client('ec2', region_name="eu-central-1") | |
vpc_dict = ec2_client.create_vpc( | |
CidrBlock='10.0.0.0/16', | |
TagSpecifications=[ | |
{ | |
'ResourceType': 'vpc', | |
'Tags': [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
response = requests.get("https://gitlab.com/api/v4/users/nanuchi/projects") | |
my_projects = response.json() | |
for each_project in my_projects: | |
print(f"Project Name:{each_project['name']}\nProject URL: {each_project['web_url']}\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post: | |
def __init__(self, message, author): | |
self.message = message | |
self.author = author | |
def get_post_info(self): | |
print(f"Post: {self.message} written by {self.author}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User: | |
def __init__(self,user_email, name, password, current_job_title): | |
self.email = user_email | |
self.name = name | |
self.password = password | |
self.current_job_title = current_job_title | |
def change_password(self, new_password): | |
self.password = new_password |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from user import User | |
from post import Post | |
app_user_one = User("pig@pig.com","Holy Pig","pwd1","DevOps EE") | |
app_user_one.get_user_info() | |
app_user_two = User("cat@cat.com","Cute Cat","pwd2","Agent") | |
app_user_two.get_user_info() | |
new_post = Post("on a secret mission today", app_user_two.name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openpyxl | |
inv_file = openpyxl.load_workbook("inventory.xlsx") | |
product_list = inv_file["Sheet1"] | |
products_per_supplier = {} | |
total_value_per_supplier = {} | |
product_under_10_inv = {} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
user_input = input("enter your goal with a deadline separated by colon\n") | |
input_list = user_input.split(":") | |
goal = input_list[0] | |
deadline = input_list[1] | |
dateline_date = datetime.strptime(deadline,"%d.%m.%Y") | |
today_date = datetime.today() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def days_to_units(num_of_days, conversion_unit): | |
if conversion_unit == "hours": | |
return f"{num_of_days} days are {num_of_days * 24} hours" | |
elif conversion_unit == "minutes": | |
return f"{num_of_days} days are {num_of_days * 24 * 60} minutes" | |
else: | |
return "unsupported unit" | |
def validate_and_execute(): | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def days_to_units(num_of_days, conversion_unit): | |
if conversion_unit == "hours": | |
return f"{num_of_days} days are {num_of_days * 24} hours" | |
elif conversion_unit == "minutes": | |
return f"{num_of_days} days are {num_of_days * 24 * 60} minutes" | |
else: | |
return "unsupported unit" | |
def validate_and_execute(): | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calculation_to_hours = 24 | |
name_of_unit = "hours" | |
def days_to_units(num_of_days): | |
return f"{num_of_days} days are {num_of_days * calculation_to_hours} {name_of_unit}" | |
def validate_and_execute(): | |
try: |
NewerOlder