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,

 » Read more..

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.

 » Read more..

Considerations when Negotiating the Fine Print of an Employment Contract

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.)

 » Read more..

How Do I Write a Script to Test if a File Exists?

Problem scenario
You want a script to test if a file is in a specific location or not. You are using Linux. What should you do?

Solution
Use this script (but modify “/path/to/file” to be the path and name of the file you are searching for):

if [ -f “/path/to/file” ]
then
echo “file exists”
else
echo “file does not exist”
fi  » Read more..

How Do You Troubleshoot the ActiveMQ Build Failure “No plugin found for prefix ‘activemq-perf'”?

Problem scenario
You run this command:

sudo /opt/maven/bin/mvn activemq-perf:broker -Durl=broker:tcp://localhost:61616

You get this result:

[INFO] Scanning for projects…
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 kB at 17 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 kB at 25 kB/s)
[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Total time: 1.815 s
[INFO] Finished at: 2020-04-28T15:33:05Z
[INFO] ————————————————————————
[ERROR] No plugin found for prefix ‘activemq-perf’ in the current project and in the plugin groups [org.apache.maven.plugins,  » Read more..

How Do You Make an Indefinite Linux Command Go to the Background So That You Have Another Prompt?

Problem scenario
You want a non-terminating (or hanging) Linux command that never finishes to go to the background. You want to use the next command line prompt. The process starts from a command you issue at the command line. How do you do you get to the next prompt?

Solution

  1. This will suspend the process momentarily. Hold control and tap “z.” Ctrl-z
  1. The above command will result in something like this:
    [555]+ Stopped python3 goodprogram.py

Craft a command like this,

 » Read more..

How Do You Fix the Error “grep: memory exhausted”?

Problem scenario
You run a grep command but it fails. You get a message about “memory exhausted.” What should you do?

Solution
Possible Solution #1
If you are comparing two files line-by-line, try reversing the order of the file arguments for the grep command. For example try these two versions:

grep -f a.txt b.txt
grep -f b.txt a.txt

If the file in the left argument is smaller,

 » Read more..

How Do You Install Boto3 on Ubuntu/Debian Linux?

Problem scenario
You want to use the latest (as of 2020) Python SDK to interact with AWS. What do you do?

Prerequisite
Install pip. See this posting.

Solution
Run these commands:

sudo pip3 install boto3

sudo pip3 install –upgrade pip

 » Read more..

What Do You Do when Your Internet Speed Is Slow?

Problem scenario
You are at home and your internet is slow. What should you do?

Possible solution #1
Reboot the cable router and any intermediate routers (i.e., any network device such as an IDS or firewall).

Possible solution #2
Log into your router’s interface to view the connected devices. To do this, find the default gateway IP address of your computer.

 » Read more..

How Do You Find Words That Match a Pattern and Not the Line with Bash?

Problem
You want to search a file for words that include a given pattern. You want to use grep to return the word that matches a pattern, and you do not want to return the entire line that matches a pattern. You want to return the exact word without the leading space or trailing space. What do you do?

Solution
Try this command:

cat foobar.txt | tr “//” “\n” | grep “coolpattern”

The above,

 » Read more..