How Do You Fix the Stack Storm Error “Failed to authenticate”?

Problem scenario
You run an st2 command, but it fails with an error like this:

Failed to authenticate with credentials provided in the config.
ERROR: 401 Client Error: Unauthorized
MESSAGE: Invalid or missing credentials for url: http://127.0.0.1:9100/tokens

What should you do?

Solution
Run a command like this (but replace “jdoe” and “passwordhere” with your credentials respectively):

st2 login jdoe –password ‘passwordhere’

Now run the st2 command(s).

How Do You Pass an Array to a Method in Java?

Problem scenario
You want to pass an argument to another piece of code (e.g., a function in Java). How do you pass an array as a parameter to another portion of code?

Solution
Java only has methods — not functions (according to this posting).

This code (which should be called contInt.java) will pass a two-dimensional array called twoD to the method “coolp”.

How Do You Create Peering Connections to EC-2 Instances, inside VPCs, So They Can Communicate with Each Other?

Problem scenario
You want to use peering connections between two VPCs (in the same region) so that EC-2 instances in each VPC can communicate with each other. How do you do this?

Solution
Prerequisite

This assumes you have two VPCs already created in the same region. This assumes you have EC-2 instances also created.

i. Create one VPC.

How Do You Troubleshoot the Error “unexpected EOF while looking for match `\”‘”?

Problem scenario
You run a Bash command or an Ansible playbook, but you get stymied by this problem: “unexpected EOF while looking for match `\”‘”

What should you do when you see this message?

Solution
Verify your escape characters have a space after the symbol that they are escaping.

For example, if you have \””

change it to \” “

The escape character may be working on two sequential symbols (without a space).

How Do You Troubleshoot “ModuleNotFoundError: No module named ‘zlib'”?

Problem scenario
You are trying to install Python 3 but you get a message about zlib. This is the full message:

rm /usr/local/lib/python3.9/lib-dynload/_sysconfigdata__linux_x86_64-linux-gnu.py
rm -r /usr/local/lib/python3.9/lib-dynload/__pycache__
/bin/install -c -m 644 ./Misc/python.man \
/usr/local/share/man/man1/python3.9.1
if test “xupgrade” != “xno” ; then \
case upgrade in \
upgrade) ensurepip=”–altinstall –upgrade” ;; \
install|*) ensurepip=”–altinstall” ;; \
esac; \
./python -E -m ensurepip \
$ensurepip –root=/ ; \
fi
Traceback (most recent call last):
File “<frozen zipimport”, …

How Do You Troubleshoot “build.cfg No such file” or “libgnu.a No Such file”?

Problem scenario
You do not have make installed, but you are trying to install it. You get the following message:

build.sh: line 21: ./build.cfg: No such file or directory
sed: can’t read lib/Makefile: No such file or directory
sed: can’t read lib/Makefile: No such file or directory
sed: can’t read Makefile: No such file or directory
sed: can’t read lib/Makefile: No such file or directory
./lib/libgnu.a: No such file or directory

What should you do?

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,