These are commands that I forget regularly and need to look up.
cat boring.json | python3 -m json.tool > pretty.json
# ~/.inputrc or /etc/inputrc | |
set bell-style none |
# --------------------------------------------------------------- | |
# If you are setting up a clean (never used) system, you can run this full batch | |
# Otherwise, I suggest running this line by line (copy/paste). | |
# | |
# Show if java, javac, or jar are already setup. Run these commands before running the rest | |
# | |
JDK_VERSION='jdk1.8.0_261' | |
echo "===============================================================" | |
echo " Processing Aternatives for "${JDK_VERSION} |
# --------------------------------------------------------------- | |
# If you are setting up a clean (never used) system, you can run this full batch | |
# Otherwise, I suggest running this line by line (copy/paste). | |
# | |
# Show if java, javac, or jar are already setup. Run these commands before running the rest | |
# | |
JDK_VERSION='jdk1.8.0_271' | |
echo "===============================================================" | |
echo "Processing Aternatives for "${JDK_VERSION} |
If you have some Raspberry PI's running Ubuntu Server 20.04 connected to a flatpanel monitor, here are the steps to configure the screen resolution. In my monitor, the default Ubuntu is selecting is terrible looking and impossible to read. It is even worse at odd angles.
Check out this raspberry pi site for video resolutions. Based on my setup...
#!/usr/bin/env python3 | |
# | |
# http://www.blog.pythonlibrary.org/2020/02/09/how-to-check-if-a-file-is-a-valid-image-with-python/ | |
# | |
import imghdr # for imghdr | |
from PIL import Image # for Image.open | |
path = 'python.jpg' | |
imghdr.what(path) | |
# returns 'jpeg' |
#!/usr/bin/env python3 | |
# | |
# https://stackabuse.com/bubble-sort-in-python/ | |
# | |
def bubble_sort(our_list): | |
# We go through the list as many times as there are elements | |
for i in range(len(our_list)): | |
# We want the last pair of adjacent elements to be (n-2, n-1) | |
for j in range(len(our_list) - 1): | |
if our_list[j] > our_list[j+1]: |
In some cases, you may have an object the you are returning in an System.Web.Http.IHttpActionResult
response where properties in the object you are returning have null
values. To minimize the size of the data structure you are returning, a formatter can be specified which will let you supress null
values.
Add using System.Net.Http.Formatting
to the top of your code file.
protected JsonMediaTypeFormatter getJsonFormatter()
In cases where you want a layer around your PostgreSQL
DB to minimize access, versus opening another port on a server for direct access (which you can restrict to an IP address or range), there is the option of accessing your DB through an SSH tunnel.
authorized_hosts
setup to allow the tunnel to open automaticallypsql
command from a client system's terminal.