Skip to content

Instantly share code, notes, and snippets.

View utdrmac's full-sized avatar

Matthew utdrmac

View GitHub Profile
/*
* To compile and install, execute the following commands. This will create a
* build location for MySQL and this plugin.
*
** Get Percona MySQL source code:
* cd ~
* wget https://downloads.percona.com/downloads/Percona-Server-8.0/Percona-Server-8.0.32-24/source/tarball/percona-server-8.0.32-24.tar.gz
* tar -xvzf percona-server-8.0.32-24.tar.gz
*
** Create plugin dir, clone C++ ULID library
#!/bin/sh
##
## For EdgeRouter Lite
## chmod 755 /etc/cron.weekly/dns-blacklist
##
BLACKLIST_URL=https://raw.githubusercontent.com/oznu/dns-zone-blacklist/master/dnsmasq/dnsmasq-server.blacklist
BLACKLIST_PATH=/etc/dnsmasq.d/blacklist.conf
WHITELIST_PATH=/config/dnsmasq-server.whitelist
if sysbench.cmdline.command == nil then
error("Command is required. Supported commands: run")
end
sysbench.cmdline.options = {
point_selects = {"Number of point SELECT queries to run", 5},
skip_trx = {"Do not use BEGIN/COMMIT; Use global auto_commit value", false}
}
local page_types = { "actor", "character", "movie" }
# -*- coding: utf-8 -*-
# Description: speedtest netdata python.d module
# Author: utdrmac
# SPDX-License-Identifier: GPL-3.0-or-later
# Runs a network speed test using speedtest.net every hour (by default)
# Requires: speedtest-cli
# apk add speedtest-cli
from bases.FrameworkServices.ExecutableService import ExecutableService
@utdrmac
utdrmac / collect_router_stats.py
Last active December 10, 2021 17:16
Monitor UPS status and graph using RRD
#!/usr/bin/python
import time
import signal, sys, os, re
import rrdtool
import requests
#
# Add data points every second (step)
# Keep:
@utdrmac
utdrmac / size-innodb-log-files.sh
Last active October 21, 2019 19:27
Sizing InnoDB Log Files
currentSize=`mysql $DSN -BNe "SELECT ROUND(@@innodb_log_file_size/1024/1024, 0)"` \
currentNum=`mysql $DSN -BNe "SELECT @@innodb_log_files_in_group"` \
totalCurSize=`mysql $DSN -BNe "SELECT ROUND((@@innodb_log_file_size * @@innodb_log_files_in_group)/1024/1024, 2)"` \
startSeq=`mysql $DSN -BNe "SHOW ENGINE InnoDB STATUS\G" | grep sequence | grep -o "[0-9]\+$"`; sleep 60; \
endSeq=`mysql $DSN -BNe "SHOW ENGINE InnoDB STATUS\G" | grep sequence | grep -o "[0-9]\+$"`; \
logSizeReq=`echo "scale=2; ((($endSeq-$startSeq)/1024/1024)*60)/$currentNum" | bc`; \
echo; echo "innodb_log_file_size is ${currentSize}MB * ${currentNum} log files = ${totalCurSize}MB"; \
echo "innodb_log_file_size setting should be at least ${logSizeReq}MB for ${currentNum} log files."; echo;
@utdrmac
utdrmac / headcheck.py
Created September 29, 2019 15:18
check current block head level from multiple sources
#!/bin/env python36
import requests
import json
from time import sleep
from datetime import timedelta, datetime as dt
from requests.exceptions import Timeout, HTTPError, ConnectionError
from concurrent.futures import TimeoutError, ThreadPoolExecutor
nodes = [
@utdrmac
utdrmac / mysql-server.init-patch
Created May 9, 2016 19:32
MySQL 5.7 Keyring Decryption Snipplet
# Encrypt initially using
# openssl rand -base64 32 >/etc/ssl/private/mykey.bin && chmod 600 /etc/ssl/private/mykey.bin
# openssl aes-256-cbc -a -salt -in /usr/local/mysql/keyring -out /usr/local/mysql/keyring.asc -pass file:/etc/ssl/private/mykey.bin
echo $echo_n "Decrypting Keyring..."
rm -f /usr/local/mysql/keyring
if [ ! -e /usr/local/mysql/keyring.asc -o ! -e /etc/ssl/private/mykey.bin ]
then
echo "Encrypted keyring and/or keyfile not found. Aborting MySQL startup."
exit 1;
fi
@utdrmac
utdrmac / make-sets.py
Created April 11, 2018 17:34
Create SET-based data for MySQL testing
#!/usr/bin/python
import random
import time
import string
from threading import Thread
from mysql.utilities.common import (database, options, server, table)
@utdrmac
utdrmac / pushbullet_ssh.sh
Last active June 12, 2017 21:14
Managing SSH with pushbullet
#!/bin/bash
# Redirect STDOUT/STDERR to journalctl
# journalctl -f SYSLOG_IDENTIFIER=pushBulletSSH
exec > >(logger -t pushBulletSSH) 2> >(logger -t pushBulletSSH -p user.warn)
# Config
GASGIANT_ID="XXXXXX"
PORTFILE=/tmp/.sshport