The Programming and DevOps Authority 馃憢

Learn how to Master the Intracacies of Software Engineering, DevOps and Cloud

How to Recursively Bash convert all your HTML to Markdown files with Pandoc

You can recursively convert all your HTML files to Mardown format in Bash, by using Pandoc. find . \-name "*.ht*" | while read i; do pandoc -f html -t markdown "$i" -o "${i%.*}.md"; done

March 29, 2023 路 1 min 路 34 words 路 Andrew

How to Create a Password Generator in C++

You can easily create a password generator in C++ with the following simple method. How to create the Password Generator in C++ #include <iostream> #include <string> #include <algorithm> #include <random> std::string generate_password(int length = 16) { std::string seed = string("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + string("0123456789") + string("[email protected]#$%^&*()_+=-{}[]\\|:;<>,.?/"); std::string password_string = seed; std::shuffle(password_string.begin(), password_string.end(), std::mt19937{std::random_device{}()}); return password_string.substr(0, length); } int main() { std::cout << generate_password() << std::endl; std::cout << generate_password(28) << std::endl; return 0; }

March 27, 2023 路 1 min 路 71 words 路 Andrew

How do you architect Disaster Recovery in AWS?

Disaster recovery (DR) in AWS involves creating a plan and set of procedures to help your organization recover from a catastrophic event, such as a natural disaster, power outage, or cyber attack, that could impact your business operations. AWS provides a range of tools and services to help you architect an effective DR solution in the cloud. Here are the high-level steps to architect a Disaster Recovery solution in AWS:...

March 26, 2023 路 3 min 路 633 words 路 Andrew

What options exist for Infrastructure as Code (IaC)

There are several options for Infrastructure as Code (IaC) tools that can help automate the provisioning and management of infrastructure resources, such as servers, networks, and storage, in a reliable and reproducible way. Here are some of the most popular IaC options: Terraform: An open-source tool by HashiCorp that supports a wide range of infrastructure providers, including AWS, Azure, Google Cloud, and more. Terraform uses a declarative language to describe infrastructure as code and can manage both low-level and high-level resources....

March 25, 2023 路 2 min 路 298 words 路 Andrew

How to learn Java in 1 day

Learning Java in one day is not a realistic goal, as Java is a complex programming language that requires time and practice to master. However, here are some tips to get you started: Start with the basics: Before diving into complex topics, learn the basics of Java, such as variables, data types, control structures, and object-oriented programming principles. Watch tutorials and read documentation: There are many resources available online that can help you learn Java quickly....

March 24, 2023 路 1 min 路 195 words 路 Andrew

How to read user input as numbers in Python

In Python 3 onwards, the input function returns a string type.. int value You can explicitly convert this into an int type. val = int(input("Enter a number: ")) float value If you need to accept fractional components, then simply swap this out with a float type: val = float(input("Enter a number:")) map multiple values If you have multiple integers in a single line, then you can use map to extract them into a list:...

March 23, 2023 路 1 min 路 78 words 路 Andrew

How to Capitalize the first letter of each word in a string in Python

If you have a sentence containing multiple words, and you want each of the words to start with a capital letter, then you can do one of the following: Option 1 - using string.capwords() import string string.capwords('this is a test!') Output: 'This Is A Test!' Option 2 - using title() 'this is a test!'.title() Output: 'This Is A Test!' Option 3 - using join(), split() and list comprehensions " ".join(w.capitalize() for w in 'this is a test!...

March 22, 2023 路 1 min 路 82 words 路 Andrew

How to Create a Password Generator in Python

You can easily create a password generator in Python with the following simple method. How to create the Password Generator in Python import string import random def generate_password(length=16): seed = f"{string.ascii_letters}{string.ascii_lowercase}{string.ascii_uppercase}{string.punctuation}" password_string = [x for x in seed] random.shuffle(password_string) return ''.join(password_string[:length]) How to use the Password Generator in Python With this function, you can either call the generate_password() function without any arguments, and it will generate a 16 digit long password, unless you need a longer one, then pass in an integer to specify the lengh of the password you would like....

March 16, 2023 路 1 min 路 115 words 路 Andrew

How to Convert Bytes to a String in Python

If you need to convert bytes to a string in Python, then you can do the following: your_string = b'This works \xE2\x9C\x85'.decode("utf-8") print(your_string) Output: This works 鉁 Note that in the above example, we have converted a utf-8 string to.

March 14, 2023 路 1 min 路 40 words 路 Andrew

How to measure the elapsed time in Python

Option 1 - using the time module import time start = time.time() print(23*2.3) end = time.time() print(end - start) Output: 52.9 3.600120544433594e-05 Option 2 - using the timeit module from timeit import default_timer as timer start = timer() print(23*2.3) end = timer() print(end - start) Output: 52.9 6.355400000000039e-05

March 13, 2023 路 1 min 路 48 words 路 Andrew