Skip to content

Instantly share code, notes, and snippets.

View detain's full-sized avatar
💯
Da Vinci of Linux, Van Gogh of Code, [self proclaimed, but legit]

Joe Huss detain

💯
Da Vinci of Linux, Van Gogh of Code, [self proclaimed, but legit]
View GitHub Profile
@detain
detain / innodb_cluster_upgrade_instructions.md
Created July 7, 2024 20:28
InnoDB Cluster Upgrade Instructions for 0 Downtime

Lets assume you have a multi-primary cluster and you want to upgrade the nodes without taking them offline.
For this say we have 3 nodes, mysqlcluster1, mysqlcluster2, and mysqlcluster3 and the cluster is currently online.

  1. Move all traffic to mysqlcluster1
  2. Do upgrades on mysqlcluster2 and mysqlcluster3, when they finish the update they will auto rejoin the cluster but stay as R/O
  3. stop mysql on mysqlcluster1, as soon as you do that mysqlcluster2 and mysqlcluster3 will go R/W
  • You will have to either:
    • time switching your db hosts in your configs with when you bring down mysqlcluster1
    • use mysqlrouter to automatically switch-over
  1. move all traffic to mysqlcluster2 and mysqlcluster3
@detain
detain / firefox_snap_sucks_apt_4tw
Last active June 29, 2024 05:34
firefox_snap_sucks_apt__4tw.sh
{ install -d -m 0755 /etc/apt/keyrings
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); if($0 == "35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3") print "\nThe key fingerprint matches ("$0").\n"; else
print "\nVerification failed: the fingerprint ("$0") does not match the expected one.\n"}'
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null
snap remove firefox
echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
@detain
detain / bash_shopt.md
Created May 4, 2024 00:09
BASH (shopt) Shell Options Explained

Bash Shel Options ( shopt ) Explained

I wasted time WTFM so RTFM

Enable OptionDisable OptionList Enabled OptionsEnabled Options Sample Output
shopt -s <opt>
shopt -u <opt>
echo $BASHOPTS
checkwinsize:cmdhist:complete_fullquote

This table illustrates the behavior of various shopt options in bash. By toggling these options, you can influence how the shell handles things like filename completion, history management, and error handling.

Option Description Disabled Enabled Example
@detain
detain / RestorePotPlayer.sh
Created March 6, 2024 12:21
Restore the most recently deleted media file from recycling bin and add to PotPlayer playlist after the current position.
# Create a Shell COM object
$shell = New-Object -ComObject Shell.Application
# Get the Recycling Bin folder
$recycleBin = $shell.Namespace(0xa)
# Get the items in the Recycling Bin
$recycleBinItems = $recycleBin.Items()
# Sort items by deletion date in descending order
$sortedItems = $recycleBinItems | Sort-Object { $_.ExtendedProperty('System.Recycle.DateDeleted') } -Descending
$potPlayerDir = "C:\Program Files\DAUM\PotPlayer"
$potPlayerFull = "C:\Program Files\DAUM\PotPlayer\PotPlayerMini64.exe"
@detain
detain / mame.md
Last active July 2, 2024 20:09
MAME Notes on Setup with Multimedia/EXTRAs and mameinfo/highscores/history/etc

MAME

Setting up MAME

Create the ini files with the appropriate command:

mame -createconfig
@detain
detain / check_errors.sh
Created August 16, 2023 18:09
Run tsc/vue-tsc converting the output to brief/easy to read JSON
#!/bin/bash
npm i -g @aivenio/tsc-output-parser;
echo "Running vue-tsc and parsing output into errors.json";
npx vue-tsc --strict --noEmit | npx tsc-output-parser > errors.json;
echo "remapping errors.json";
echo '<?php
$errors = [];
$jsonOpts = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES;
$json = json_decode(file_get_contents("errors.json"),true);
foreach ($json as $row) {
@detain
detain / install_themes.ps1
Created June 1, 2023 01:36
Downlaods and installs a bunch of additional nice themes for Notepad++ installer in powershell and bash flavors.
$programFilesThemesDir = "$env:PROGRAMFILES\Notepad++\themes\"
$appDataThemesDir = "$env:APPDATA\Notepad++\themes\"
# Check if both directories exist
$programFilesThemesExist = Test-Path -Path $programFilesThemesDir
$appDataThemesExist = Test-Path -Path $appDataThemesDir
# Prompt the user to select the installation directory
if ($programFilesThemesExist -and $appDataThemesExist) {
$installToProgramFiles = Read-Host "Both 'Program Files' and 'AppData' themes directories exist. Where do you want to install the themes? Enter 'P' for Program Files or 'A' for AppData."
$installToProgramFiles = $installToProgramFiles.ToUpper()
} elseif ($programFilesThemesExist) {
@detain
detain / mtl_obj.md
Created May 12, 2023 19:13
three.js noters and stuff

To create a three.js page that loads a 3D model, you'll need to do the following steps:

  1. Create an HTML file that includes the necessary scripts and libraries.
<!DOCTYPE html>
<html>
  <head>
    <title>Three.js Model Loader</title>
    <meta charset="UTF-8">
@detain
detain / response1.md
Created May 12, 2023 16:42
adding keyboard movement to three.js

To add WASD keyboard movement support to the webgl_loader_fbx.html file from the Three.js GitHub repository, you can make the following changes:

  1. First, add a controls variable to the JavaScript code near the top of the file, to store the instance of the THREE.OrbitControls object:
var camera, controls;
  1. Next, locate the init() function and add the following code after the camera variable is defined, to instantiate the OrbitControls object and set some initial values: