Skip to content

Instantly share code, notes, and snippets.

View josephbolus's full-sized avatar

Joseph Bolus josephbolus

View GitHub Profile
@josephbolus
josephbolus / README.md
Last active October 28, 2024 02:39
Calculates optimized MySQL 8 settings based on system resources.

How to use:

jbolus@sandbox:/tmp$ chmod +x mysql-conf-optimizer.sh
jbolus@sandbox:/tmp$ ./mysql-conf-optimizer.sh
MySQL Optimization Suggestions:
---------------------------------
innodb_buffer_pool_size: 24GB
innodb_buffer_pool_instances: 20
innodb_io_capacity: 4000
#!/bin/bash
# https://docs.rockylinux.org/guides/interoperability/import_rocky_to_wsl/
sudo dnf upgrade --refresh
dnf upgrade --refresh
sudo
dnf install -y nano mc passwd sudo dnf-plugin-config-manager wget dnf-plugins-core tree dos2unix epel-release NetworkManager iproute
su root
sudo mc
ls
sudo dnf config-manager --set-enabled crb
@josephbolus
josephbolus / mysql-high-cpu.md
Last active October 3, 2024 06:29
Troubleshooting High CPU in MySQL

Troubleshooting High CPU in MySQL

tags: linux dba mysql

Overview

With MySQL 5.7, the PERFORMANCE_SCHEMA.THREADS table added THREAD_OS_ID. This column helps identify sessions consuming high CPU resources, especially when one query overloads a CPU core.

To troubleshoot, use pidstat from the sysstat package. The -t option shows thread-level usage, and -p with the MySQL process ID filters results to MySQL threads:

@josephbolus
josephbolus / docker-iptables-fix.sh
Last active August 9, 2024 02:59 — forked from pedrolamas/docker-iptables-fix.sh
Forwarding real IP when running as a container by fixing Docker iptables on Synology NAS
#!/bin/bash
currentAttempt=0
totalAttempts=10
delay=15
while [ $currentAttempt -lt $totalAttempts ]
do
currentAttempt=$(( $currentAttempt + 1 ))
echo "Attempt $currentAttempt of $totalAttempts..."
@josephbolus
josephbolus / printer.conf
Created August 2, 2024 02:25 — forked from jasonehines/printer.conf
Ender 3 Pro Creality 4.2.7 with bltouch - Klipper printer Configuration
# This file contains pin mappings for the Creality "v4.2.7" board. To
# use this config, during "make menuconfig" select the STM32F103 with
# a "28KiB bootloader" and serial (on USART1 PA10/PA9) communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
@josephbolus
josephbolus / marks.md
Created July 4, 2024 20:10
Small scripts, hacks and automations.

This is more in the "hack" category, but here is a solution for bookmarking directories[1] that I am quite fond of:

mkdir -p ~/.marks/
export CDPATH=.:~/.marks/
function mark { ln -sr "$(pwd)" ~/.marks/"$1"; }

Then:

@josephbolus
josephbolus / scan.sh
Created July 4, 2024 19:49
Use the following tiny script to make PDFs look like they have been scanned.
#!/bin/sh
# Help message
show_help() {
echo
echo "Convert PDFs to make them look like they have been scanned"
echo "Example: $0 file.pdf"
}
# Check if the provided argument is not empty
@josephbolus
josephbolus / dracula-theme.css
Last active July 5, 2024 20:17
dracula-theme.css
/* Casual stab at modifying the Bookstack main theme using the Dracula color scheme. Download and use at your own risk. */
/* https://github.com/domainzero/bookstack-dark-theme */
/* optional */
/* uppercase titles */
.page-content h1{text-transform:uppercase}
h1.break-text{text-transform:uppercase}
/* Dracula stuff */
/* background */
@josephbolus
josephbolus / install_zellij_btop.sh
Created June 2, 2024 23:07
Installs Zellij and btop with custom MacOS keybindings
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Variables
zellij_version="0.40.1"
btop_version="1.3.2"
zellij_file="zellij-${zellij_version}.tar.gz"
@josephbolus
josephbolus / redis.conf
Created April 24, 2024 19:26
default Redis config
# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#