How Do You Use the Bisect Module in Python?

Problem scenario
You want to use bisect in Python. How do you do this?

Solution

# This program was adapted from code found
# https://docs.python.org/3/library/bisect.html

import bisect
def grade(score, breakpoints=[60, 70, 80, 90], grades=’FDCBA’):
i = bisect.bisect(breakpoints, score)
return grades[i]

x = [grade(score) for score in [71, 88, 94]]
print(x)

import bisect
def whether(temperature, breakpoints=[38, 70, 80, 100], descriptors=[”cold”, “cool”, “warm”, “hot”, “very hot”]):
i = bisect.bisect(breakpoints, …

How Do You Configure Email Alerts for AWS Spending Thresholds of Specific Dollar Amounts?

Problem scenario
Sometimes you forget what is running in AWS. You want to be notified when you have spent a certain amount of money. How do you set up a notification in your AWS account that will apprise you when you have have spent over a certain amount of money for a given month?

Solution

  1. Log into the AWS Management Console (aka the web UI).

What Do You Do when ImportExportTools is Not an Option in Thunderbird?

Problem scenario
You installed ImportExportTolls NG, the add-on in Mozilla Thunderbird. In Thunderbird you go to Tools, but “ImportExportTools” or “ImportExportTools NG” is not visible. What do you do?

Solution
You need to have a mailbox — even an empty mailbox — configured. This will import all the messages you are trying to import into that mailbox. The hamburger icon’s Tools -Import,

Why Cannot a User Approve a Release Pipeline to an Environment?

Problem scenario
A user in Azure DevOps cannot approve releases to a given environment. The permissions are correct; the user is a member of the relevant custom security group in the project. Why can’t the user approve the deployment to an environment?

Solution
Can the user go to the Azure DevOps organization? Can the user also see the project? The organization subsumes a project,

How Do You Troubleshoot a Kubernetes Cluster That is Not Working at the Node Level?

Problem scenario
The nodes in a Kubernetes cluster are not working. What should you do?

Possible Solution #1
Run this command: kubectl get nodes
For the node that is not healthy, assuming its hostname is called “foobar”, run this command: kubectl describe node foobar

Possible Solution #2
If you have pods and no nodes (which could be the case),

How Do You Troubleshoot “java.io.IOException: Stream closed at java.base/java.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:442)”?

Problem scenario
You are trying to run a Hadoop job. You get this error:
“java.io.IOException: Stream closed at java.base/java.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:442)”

What should you do?

Solution
Is the “python” command recognized as such? You may need to install Python or link the python3 binary to be in a typical location where env variables would look for it (e.g., /usr/bin/python).

Here are commands that could help you:

whereis python3
sudo ln -s python3 /bin/python

If you need help installing Python,

How Do You Find the Details of Permissions/Privileges of a User in GitHub Enterprise?

Problem scenario
You are using GitHub Enterprise. You want to see the details of a user’s permissions (e.g., when it was created or before someone modified the user’s ability to control repos). What do you do?

Solution

  1. Go to the Audit Log in the web UI. (To learn more about this, see this external site.)
  2. Search for the user by the username.

How Do You Solve the MacOS Command Line Error “No Java runtime present…”?

Problem scenario
Using a MacOS, you are trying to run a command (e.g., a “java” command) from the Terminal utility (character prompt). You get the message “No Java runtime present”, and the command fails. What should you do?

Solution
Using the GUI, download the .dmg file from here.

Once it is downloaded, double click it. Follow the menu steps (Continue ->