Redshift locked tables

Redshift: Detect and Cancel Long running queries Per User Connection

Troubleshooting in Redshift

Show locked tables, highlight the query and run it, copy the pid

Show Locked Tables

/* Show locked Tables */
FROM pg_locks l 
JOIN pg_catalog.pg_class c ON c.oid = l.relation
JOIN pg_catalog.pg_stat_activity a ON a.procpid =
WHERE <> pg_backend_pid();Show locks, oldest first

Kill Session (note change "pid" to a process with a lock from above)

/* kill session, Redshift ends session and rolls back all transactions that are associated with it. */
select pg_terminate_backend( pid )

Show locks, oldest first

Docker on Ubuntu 20.04.01 Tips

Don't install Docker from the Ubuntu software app, instead:

Follow this guide from Docker

$ sudo apt install

$ sudo apt-get install docker-compose

Verify install

$ docker–compose –version

Verify Docker

$ sudo docker run hello-world

To remove docker-compose

$ sudo apt-get remove docker-compose

$ sudo apt-get autoremove

Show all Docker container names and IP addresses

$ docker inspect -f '{{.Name}} - {{.NetworkSettings.IPAddress }}' $(docker ps -aq)

List Docker Images and Containers

To display a list of all Docker images stored locally:

$ sudo docker images ls –a

The –a option shows all docker images. You should see a listing with the hello-world image.

To see a list all containers use:

$ sudo docker ps -a

To view all currently running containers:

$ sudo docker ps

Note that this list is empty. This shows you that once the hello-world image completes, it closes out automatically.

Remove a Docker Image and Container

To remove a Docker image, you need to know its IMAGE ID. Use the command for listing images from the passage above to copy that information.

VNC connection to Raspberry Pi "Unknown authentication scheme from VNC server: 13, 5, 6, 130, 192"

Trying to connect to VNC on Raspberry Pi 4b from Ubuntu gives the following error: 

Unknown authentication scheme from VNC server: 13, 5, 6, 130, 192

In VNC Server on Raspberry Pi 3

Go to the options on the VNC Server on Raspberry Pi 3 and you should have the sudo credentials when you started VNC server

Change the security authentication to VNC Password as shown belowVNC Options

Finally you need to add a user to use it to connect. In my case I created an administrator user (default username was admin)

In Remmina on Ubnutu

You will create a new connection with the given IP address of the Raspberry Pi on your local network (you should be able to know it using ifconfig) and using the admin user credentials created on VNC server as the following: Remote Desktop Preferences


Installing VNC on Raspberry PI

To use VNC you first need to install a GUI desktop

Tinkercad meshes are limited to 300,000 triangles

This shape's mesh is too complex. Tinkercad meshes are limited to 300,000 triangles.  Try simplifying the mesh before re-importing it.

Sometimes a STL file has too much detail for Tinkercad.  If you just want to view what is in the file you can try gmsh.

$ sudo apt install gmsh
$ gmsh &

MeshLab, open source and free for Windows, Mac and Linux

Polygon reduction with MeshLab

Mesh reduction


$ sudo apt install meshlab

or Download MeshLab

From the menu, select Filters > Remeshing, simplification and construction > Quadratic Edge Collapse Detection. If your model is textured, there is also an option (with texture) that will do a good job at keeping your textures positioned properly. A panel with a few options will show up. 

Here are the optimal option settings: 

Summary - The Obstacle Is The Way

The Obstacle Is The Way by Ryan Holiday: Book SummaryThe Obstacle Book Cover

The impediment to action advances action. What stands in the way becomes the way.” Marcus Aurelius

It’s this line from Marcus Aurelius, written nearly 2,000 years ago in his private diary, that served as the inspiration for the international bestseller The Obstacle Is The Way by Ryan Holiday. It is a book that has become a cult classic and required reading for athletes, entrepreneurs, artists or anyone who is looking for a timeless framework for overcoming the obstacles and adversities life throws at us.

12 Best Quotes from The Obstacle Is the Way

“Whatever we face, we have a choice: Will we be blocked by obstacles, or will we advance through and over them?”

Ender 3 Filament Settings

Settings for Ender 3 for different filaments

  PLA (Polylactic acid) - Most common 3D printing material. But what does it take to print it on the Ender 3?  Quite simply, nothing much. PLA is a versatile material, hard brittle.
Printing temperature 180-230 °C
Build plate temperature A modest 20-60 °C helps a lot. Any higher and the PLA at the bottom might deform.
Bed adhesion The stock build surface on the Ender 3 provides excellent bed adhesion for PLA. But for a smoother bottom surface, glass is a better option. When using glass, hairspray or glue stick work the best. They give your prints a good hold on the bed.
Print speed A general recommended speed of 60 mm/s works great, balancing quality with printing time.
Retraction As the Ender 3 has a Bowden style setup, retraction settings are much higher. We only need to consider two factors here.
  Retraction distance: 5 mm
  Retraction speed: 45 mm/sec
Part-cooling fan This should be on.

How to restore missing command history on Mac iTerm

I noticed on my Mac that sometimes my command history gets lost. In researching I came across this article Bash History missing from Terminal

I build this script which I place in my home directory, but it could be any place as long as it is run from the user who lost their command history.  The features are that it will find any commands that are missing from the .bash_history and add them while preserving the order of the existing command history.

$ more
# Restore missing command history for user
MYUSER=`id -un`
cat /Users/$MYUSER/.bash_sessions/*.history | sort | uniq >> /Users/$MYUSER/.bash_history2

# copy missing command history to bash_history
awk '{if (f==1) { r[$0] } else if (! ($0 in r)) { print $0 } } ' f=1 /Users/$MYUSER/.bash_history f=2 /Users/$MYUSER/.bash_history2 >> .bash_history
rm /Users/$MYUSER/.bash_history2