Skip to content

Instantly share code, notes, and snippets.

View uuklanger's full-sized avatar

uuklanger

View GitHub Profile
@uuklanger
uuklanger / howto_setup_pylint_with_pycharm.md
Last active December 4, 2023 20:44
HOWTO - Setup pylint with PyCharm and the PyLint Plugin

Overivew

Setting up a linter can help detect odd or non-typical coding practices. The following will describe how to setup PyCharm for basic linting with the PyCharm PyLint plugin.

This assumes you have a venv setup within your current project.

Install Pylint

For pylint for your current project venv the following two commands should be run in your project root. The first will install pylint and the second will create an rc file which you can then adjust for your current project.

@uuklanger
uuklanger / MakeGitKrakenSSHKEY.sh
Last active January 21, 2022 18:13
HOWTO: Create a ssh RSA Key compatible with GITKRAKEN
$ ssh-keygen -t rsa -m PEM -b 4096 -C "mylogin@HOST"
OR the modern way
$ ssh-keygen -t ed25519 -C "your_email@example.com"
@uuklanger
uuklanger / helpful_shell_commands.md
Last active August 18, 2021 02:46
Helpful Shell Commands

Helpful Command Cheet Sheet

These are commands that I forget regularly and need to look up.

Format JSON output as pretty

cat boring.json | python3 -m json.tool > pretty.json
@uuklanger
uuklanger / tilda.inputrc
Created June 29, 2021 13:18
Turn off bash bell sound in Terminal
# ~/.inputrc or /etc/inputrc
set bell-style none

Overview

If you want to reformat JSON output from a single line to a nicely formatted document, you can use the following trick.

cat boring.json | python3 -m json.tool > pretty.json
@uuklanger
uuklanger / remove_old_alternative.sh
Last active November 11, 2020 23:08
remove_old_alternative.sh
# ---------------------------------------------------------------
# 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}
@uuklanger
uuklanger / setup_alternatives.sh
Last active October 28, 2020 00:48
setup_alternatives.sh
# ---------------------------------------------------------------
# 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}
@uuklanger
uuklanger / RPI_framebuffer_resolution.md
Created July 31, 2020 18:11
HOWTO Set the resolution of the boot console using Ubuntu 20.04 on a Raspberry Pi 3B

Overview

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

  • I have Ubuntu 20.04 running on a RPI3B+
  • I would like 1920x1080 for a 60Hz display. I have an LG 24" monitor
  • Reading my monitors documentation, I know this is the max safe resolution
  • My monitor is connected by an HDMI cable and is digital
@uuklanger
uuklanger / howto_connect_to_pgsql_via_ssh.md
Last active June 11, 2020 16:05
HOWTO - Connect to a PostgreSQL DB though an SSH Tunnel

Overview

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.

Considerations

  • This can be slower
  • You will want authorized_hosts setup to allow the tunnel to open automatically
  • Some tools like Navicat, will help do this for you if you set your server to "local" in the General tab and use the server dns name in the SSH tab. The following is only needed if you are using the psql command from a client system's terminal.
@uuklanger
uuklanger / check_if_file_is_image.py
Created February 10, 2020 17:41
HOWTO - Check to see if File is Image
#!/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'