How Do You Paste Copied Content without the Formatting Using a Mac?

Problem scenario
You have a Mac and want to copy heavily-formatted text from a web page or Excel spreadsheet into TextEdit. But you do not want the formatting to come with it. How do you do this?

Solution

  1. Copy it as you normally would.
  2. If you are using a Microsoft keyboard, use Alt-Windows-Shift-v to paste it. If you are using a Macintosh keyboard, use Option-Command-Shift-v.

How Do You Troubleshoot the Unexpected Output to a grep Command “Binary file (standard input) matches”?

Problem scenario
When grepping a file or output, you get "Binary file (standard input) matches". You only see a subportion of the matching strings. What should you do?

Solution
Use the -a flag. Here is an example:
cat foobar.txt | grep -a coolterm

How Do You Fix a Drain Pop Up Stopper That Will Not Go Up and Down or Move Vertically Like It Should?

Problem scenario
Your drain stopper in your bathroom sink has broken. You can no longer place a plastic/chrome pop-up stopper to be connected to a rod inches into the drain. The metal or plastic protrusion rod is no longer visible in the drain. It broke off and fell into the drain pipe (e.g., the P-Trap). How do you fix this problem with replacing the fewest amount of tools and parts?

Solution
Buy a ball rod assembly that has different size balls. This is a ball-and-socket mechanism. You won't need other wing nuts or pipes. You just need a drain ball rod assembly. You can buy one here: DANCO (88532) Universal Pop-Up Drain Ball Rod Assembly

To learn more about how to replace it and other parts of a pop-up drain in a bathroom sink, see this video.

How Do You Fix the Ansible Problem about “libselinux-python”?

Problem scenario
You try to run an Ansible playbook, but you get an error like this: "msg: Aborting target uses selinux but python bindings (libselinux-python) aren't installed!"

You are using a Red Hat derivative of Linux (e.g., Red Hat Enterprise Linux, CentOS or Fedora) and Python 3. What should you do?

Solution
Prerequisite

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

Procedures
Run this command: sudo pip3 install selinux

How Do You Get yum Commands to Work?

Problem scenario
You run run commands, but they fail. The error you see is "Trying other mirror [Errno 14] curl #7…"

What should you do?

Solution

  1. If the output refers to a DNS name, see if the DNS name is for a load balancer (e.g., an ELB), a router, or a server. See if it is pingable. If it is not, find a Linux server in your network that has yum commands working. See if you can ping the DNS name from that Linux server.
  2. If another server on your network has yum commands working, compare /etc/yum.conf files of both. Compare /etc/yum.repos.d/*.repo files too.
  3. See if a firewall, network ACL, AWS Security Group, or Azure Network Security Group is preventing communication with the internet. In other words see if you can ping 8.8.8.8.
  4. See also How Do You Troubleshoot Yum Commands Not Working with the Error “Could Not Resolve Host: mirror.centos.org Unknown Error?

How Do You Troubleshoot the Postfix Error “454 4.7.1 jdoe@acme.com: Relay access denied”?

Problem scenario
You are trying to send an email on a Postfix server. But you keep getting this error: "454 4.7.1 jdoe@acme.com: Relay access denied"

What should you do?

Solution

  1. Back up the /etc/postfix/main.cf file just in case. (This is an optional step.)
  2. Find you server's internal IP address with a command like this: ip addr show | grep eth0 | grep inet | awk '{print $2}'
  3. Modify the /etc/postfix/main.cf file. Go to the "mynetworks" stanza. Verify you see the server's IP address there with a shorthand notation of a relevant subnet mask (e.g., a CIDR). It should look something like this:

172.5.4.0/24 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

  1. Either reboot the server or run this command to have the changes take effect: sudo postmap /etc/postfix/generic

How Do You Troubleshoot Ansible Errors about SELinux?

Problem scenario
You have Python 3 installed, but you do not have pip3 installed. One of the following also apply to your situation:

Problem scenario #1
You run an Ansible playbook. You receive the error message "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed."

Problem scenario #2
You run an Ansible playbook. You receive the error message "module 'selinux' has no attribute 'is_selinux_enabled'".

What should you do?

Solution
Assuming you pip has been installed, do the following:

1. Run this command (where /path/to is the directory path to where pip is installed):
sudo /path/to/pip install --upgrade pip

2. Run this command:

sudo pip3 install selinux

You are done.

If you cannot install pip (and it is not installed), see this posting How Do You Get the libselinux-python to Work with Python 3?.

How Do You Get the libselinux-python to Work with Python 3?

Problem scenario
You have Python 2 and Python 3 installed. When you run Python 3 programs, you get an error message about selinux. The message is consistent with libselinux-python not being installed.

When you enter the Python interpreter for Python 2, you can run this command without errors: import selinux

But when you enter the Python interpreter for Python 3 (e.g., python3), you get errors when you run this command: import selinux

Security of the server is not critical, and you have no access to download packages from the internet. What should you do?

Solution

  1. Run this command from a terminal: python -v
  2. From the Python 2 interpreter line, run this command: import selinux
  3. The output of the above should show where selinux is. Enter this command to get back to a command prompt: quit()
  4. Find where Python 3's packages should be with this command: sudo find / -name site-packages | grep python3
  5. Run a command like this to create site-packages in a Python 3 directory if you found nothing from step #4.
sudo mkdir -P /path/to/destination/site-packages
  1. Run a modified version of this command: sudo cp -R /path/to/source /path/to/destination/site-packages
    But replace /path/to/source with the site-packages directory found in step #2's results. Replace /path/to/destination with the site-packages directory found in step #4 or created in step #5.

How Do You Troubleshoot the “aws ssm” Command Failing with a Message about “InvalidInstanceId”?

Problem scenario
In AWS Systems Manager you run an "aws ssm" command. You get "An error occurred (InvalidInstanceId) when calling the Send Command operation." What should you do?

Solution
Are there spaces or braces inside the double quotes? These symbols are not part of the instance ID. If you are running a script or complex command, extraneous symbols may be getting injected into your instance ID.

Considerations when Negotiating the Fine Print of an Employment Contract

Bill Gates' father was an attorney, and President of the Washington State Bar Association (according to this site). Bill Gates was concerned with the details of contracts in Microsoft's early days.

I.T. Contractors need to understand American law. To learn about how the contract language works, you may want to hire an attorney. To prepare yourself beforehand, you should try to learn more. If you are an independent contractor who performs software consulting, DevOps engineering, or programming services click here and use this form to protect your status as a worker. (We do not warrant the services of other products. This website is for information only.)