How Do You See the Desktop of a Mac when Using an Atypical Keyboard?

Problem scenario
You want to minimize all your Mac applications to view the desktop only. But you are using a non-standard keyboard. With a Microsoft keyboard (or some non-Apple keyboard), how do you see the desktop on a Mac?

Solution
Hold Fn and tap F11. (With a normal Mac keyboard, holding Command and tapping F3 works.)

How Do You Install Python 3.x on Any Type of Linux?

Problem scenario
You want a script to install Python 3.x that will work on any type of Linux. What should you do?

Solution
Prerequisite

Install make. If you need assistance, see this posting.

Install the zlib development tools. If you have a Red Hat derivative (e.g., CentOS or Fedora), you this command: sudo yum -y install zlib-devel

If you have a Debian/Ubuntu system, use this: sudo apt -y install zlib1g-dev

If you have a SUSE server, run this: sudo zypper -n install zlib-devel

Procedures
Run this script (e.g., sudo bash installer.sh):

echo "This will fail if the zlib development tools have not been installed"
sleep 3
curl -k https://www.python.org/ftp/python/3.9.0/Python-3.9.0a1.tar.xz > Python-3.9.0a1.tar.xz
mv Python-3.9.0a1.tar.xz /usr/bin/
cd /usr/bin/
tar xf Python-3.9.0a1.tar.xz
cd Python-3.9.0a1
./configure --prefix=/usr/local
make && sudo make altinstall
# You must use "altinstall" in the command above.  If you use "make install", you will have two versions of Python installed.
ln -s /usr/bin/Python-3.9.0a1/python /usr/bin/python

How Do You Connect to an EC-2 Instance in a VPC?

Problem scenario
You cannot reach the public IP address of an EC-2 instance. You get "Network connection timed out" errors. The EC-2 instance is in a VPC. You have configured the relevant Network ACLs of the VPC and the EC-2 instance's Security Groups to allow connectivity from your workstation. What could be wrong?

Solution

  1. Make sure you have an Internet Gateway that has been created and attached to the relevant VPC. To do this you would go to the VPC Dashboard and go to "Internet Gateways". Then click "Create internet gateway". Once it has been created, click on the radio button of the internet gateway, then go to Actions -> "Attach to VPC". Choose the VPC that is relevant.
  2. Make sure you have Route Tables associated with the VPC that include a target to the Internet Gateway configured earlier (e.g., in #1). The Internet Gateway should be attached to the relevant VPC. You may want to have traffic destined for 0.0.0.0/0 (any traffic) to be routed to the Internet Gateway. This is not the most secure way, but for convenience, this may be how you set it up.

How Do You Troubleshoot “config.status: error: Something went wrong bootstrapping makefile fragments”?

Problem scenario
You run this command: sudo ./configure --prefix=/usr/local

But you see this:

config.status: error: in `/usr/bin/make-4.3':
config.status: error: Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).

What should you do?

Solution
Run this: sudo bash build.sh

How Do You Read a JSON File to Extract the Value of a Given Key in a JSON File?

Problem scenario
You want to print the value of a given non-nested key in a JSON value. How can Python help you achieve this?

Solution
Here is an illustrative example. Create a file called reader.py with the following lines of code:

import json
with open("first.json", "r") as reading_content:
i = reading_content.read()
j = json.loads(i)
print(j["bird"])

Have the JSON file look like this:

cat first.json
{"bird": {"name": "singy", "species": "sparrow", "amount": "45"}}

Run the program like this (with first.json in the same directory as the Python program): python3 reader.py

What Is the Syntax for Viewing ec2_instance_info Return Values in Ansible?

Problem scenario
You read about a supported data type (defined keys) in Ansible playbooks related to EC-2 servers in AWS. How do you view this data?

Solution

  1. Have a playbook (.yaml file) with the following syntax:

ec2_instance_info:
region: us-west-1
register: vara

  1. Refer to vara as a variable. Here is an example of how to see it:

debug:
msg: "{{ item.instance_id }}"
loop: "{{ vara.instances }}"

How Do You Get xargs to Execute Rather Than Print a Command?

Problem Scenario
You are writing a Bash command to craft AWS CLI commands. But the commands are not running with your xargs command. You created something like this:

aws s3 ls s3://bucketname/ | awk '{print "/usr/local/bin/aws s3 rm s3://bucketname/"$4}' | xargs -L 1

But it merely displays the well-crafted AWS CLI commands. You want the commands to execute.

You tried a variation but received "xargs: awscli: No such file or directory."

What should you do?

Solution

  1. Find where you AWS binary is. Run this: whereis aws
  2. Place the location before the "aws" command so it appears in the "print" statement of your awk command.

Rewrite the command. This example uses "tail" in case you are dealing with many files in an s3 bucket. You want to have all the command drafted after the xargs -L 1 portion. The piped output should be just the variable for the command (and flags) to run. Here is an example of a command that would work:

aws s3 ls s3://bucketname/ | tail -n 10 | awk '{print "s3://bucketname/"$4}' | xargs -L 1 aws s3 rm

How Do You Unhighlight Text in Mac’s TextEdit program?

Problem scenario
You are using a Mac and modifying text with TextEdit. Some text you copied is highlighted. How do you unhighlight the text?

Solution
Highlight the text that is highlighted with the mouse. There should be two pallettes at the top of the TextEdit application. These are solid-color rectangular icons to the right of the font size and to the left of the BIU (bold, italicize, underscore) icons. The righthand pallette should have a letter "a" in it. Click this pallette. Choose the option that has a red diagonal line through it.

This media.idownloadblog.com picture has an illustrative example of where to click first. You just click there then find the option with a red diagonal line on it.

How Do You Troubleshoot the CloudWatch Command Line Error “no outputs found, did you provide a valid config file”?

Problem scenario
You think your amazon-cloudwatch-agent.toml file has been misconfigured. You run "amazon-cloudwatch-agent-ctl" but you get an error about "no outputs found, did you provide a valid config file." What should you do about this error?

Solution

  1. Use amazon-cloudwatch-agent-config-wizard to create the configuration file. From the command line it will walk you through step-by-step directions in text.
  2. Assuming the default configuration has been saved as "AmazonCloudWatch-linux" (based on how you responded above), run this command to get it to be used:

sudo amazon-cloudwatch-ctl -a fetch-config -m ec2 -c ssm:AmazonCloudWatch -linux -s

Does Automation Subsume DevOps or Does DevOps Subsume Automation?

Question
Is automation bigger than DevOps?

Answer
We think that the canonical answer is yes, automation subsumes DevOps. Some professionals think in terms of automation, and automation existed before DevOps was a word. It is well known that the Toyota Production System has influenced DevOps. Automation played a big role in the success of Sakichi Toyoda.

His "most famous invention was the automatic power loom ["a hand-operated or power-driven apparatus for weaving fabrics", taken from Dictionary.com] in which he implemented the principle of Jidoka (autonomous automation). The principle of Jidoka, which means that the machine stops itself when a problem occurs, became later a part of the Toyota Production System." Taken from Wikipedia.

Automation may seem commonplace. But it is quite complex. Sophisticated automation in I.T. uses DevOps. To be fair, some people would consider DevOps to be a field that leverages automation; this characterization would render automation "smaller" than DevOps. Page 360 of The Phoenix Project (5 year anniversary edition) says 'As Christopher Little, a technology executive and one of the earliest chroniclers of DevOps, wrote, "DevOps isn't about automation, just as astronomy isn't about telescopes."'

In some ways automation and DevOps are different subjects like the same way biology and chemistry are different from each other. To the extent that they are related, automation predates DevOps. Automation is central to I.T.