Skip to content

Instantly share code, notes, and snippets.

@ronaldbradford
ronaldbradford / OBS.txt
Last active October 23, 2024 00:45
Pokémon Wish Lists Reverse Holofoil/Energy
Reverse Holofoil I Need from Obsidian Flames (OBS)
#5 - Shuckle
#29 - Ninetales
#30 - Entei
#37 - Lampent
#45 - Lapras
#62 - Palafin
#70 - Thundurus
#85 - Togekiss
@ronaldbradford
ronaldbradford / README.md
Last active October 23, 2024 14:22
Minimalistic MySQL collection scripts

These bash scripts do the smallest amount of work possible to collect simple MySQL metrics and running SQL queries of a running system for subsequent analysis. These scripts include:

  • collect-mysql-status Snapshot of Status, ProcessList and supporting information for 60 seconds
  • sample-mysql-queries SQL sampling (brute force approach) for approximately 20 seconds

These scripts are designed to be executed on a Linux host, and require the mysql client to be installed, and MySQL credentials to run SQL placed in the $HOME/.my.cnf file.

NOTE: The output of information of SQL statements may include PII information. It is important data is reviewed and masked.

@ronaldbradford
ronaldbradford / diff.py
Created September 18, 2024 14:29
Diff two csv files with two columns of name/value pairs
import csv
import sys
# Function to check if a value is numeric
def is_numeric(value):
try:
int(value)
return True
except ValueError:
return False
@ronaldbradford
ronaldbradford / README.md
Last active June 11, 2024 17:45
MySQL 8.0 Memory capacity 'range_optimizer_max_mem_size' exceeded.

An experiment to trigger the "Range optimization was not done for this query" Warning

Warning (Code 3170): Memory capacity of 8388608 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.

This was produced with 1M rows of data.

> SELECT COUNT(*) FROM sysbench.filler2;   # Will match total number of events
@ronaldbradford
ronaldbradford / vmselect.sql
Created May 31, 2024 13:58
MySQL Selects 1m/5m/15m/60m
SELECT 'Start' AS msg, NOW();
SHOW GLOBAL STATUS LIKE 'com_select';
SELECT SLEEP(60 * 1);
SELECT '1m' AS msg, NOW();
SHOW GLOBAL STATUS LIKE 'com_select';
SELECT SLEEP(60 * 4);
SELECT '5m' AS msg, NOW();
SHOW GLOBAL STATUS LIKE 'com_select';
SELECT SLEEP(60 * 10);
SELECT '15m' AS msg, NOW();
@ronaldbradford
ronaldbradford / README.md
Last active May 22, 2024 20:48
MySQL CAST ARRAY Problem

Reported as https://bugs.mysql.com/bug.php?id=115085

  • Create Table
  • Load Table
  • Query with NULL
  • Query with an array with values
  • Query with empty array [] PROBLEM

Reproducible using 8.0.34 Docker Container

@ronaldbradford
ronaldbradford / WHISPER.md
Last active May 25, 2024 21:43
Whisper Example to extract text transcription from YouTube
# https://github.com/openai/whisper
pip install -U openai-whisper
brew install ffmpeg

# https://formulae.brew.sh/formula/youtube-dl. (Deprecated, owner shutdown but still works)
brew install youtube-dl


youtube-dl -x https://youtu.be/Nx-X4hVQGyQ
@ronaldbradford
ronaldbradford / optimizer-trace.json
Created January 19, 2024 19:47
Full MySQL optimizer trace for "How to capture supporting information with your SQL statements"
{
"steps": [
{
"join_preparation": {
"select#": 1,
"steps": [
{
"expanded_query": "/* select#1 */ select `a`.`country_code` AS `country_code`,`c`.`name` AS `name`,count(0) AS `cnt` from (`airport` `a` join `country` `c` on((`a`.`country_code` = `c`.`country_code`))) group by `a`.`country_code`,`c`.`name` order by count(0) desc limit 10"
},
{
@ronaldbradford
ronaldbradford / README.md
Last active January 18, 2024 16:14
Monitor a connection to a MySQL Endpoint

Use this script to monitor an RDS instance endpoint, RDS proxy endpoint, Route 53 endpoint during any testing or failover operations.

    $ watch --differences -n 1 -t "./monitor-mysql-connection.sh"

First Time Install Instructions for Mac OS

  • System Preferences | Sharing | Set Computer Name (CLI automated)
  • System Preferences | Sharing | Tick Remote Login
  • System Preferences | Trackpad | Scroll & Zoom | untick Scroll Direction (CLI automated)
  • Set Screenprint to dedicated location (CLI automated)
  • Set default shell to bash (CLI automated)
# Set Computer Name