Skip to content

Instantly share code, notes, and snippets.

View utdrmac's full-sized avatar

Matthew utdrmac

View GitHub Profile
#!/bin/bash
#
# 20210119 - Use the new --endpoint flag
# - Added verbose logging
#
# 20200608 - Updated to TzKt API
#
# 20191029 - Added /v3/network back in.
# Thanks to Baking-Bad and their Mystique API
@utdrmac
utdrmac / mysql_autoinc_checker.go
Created April 12, 2018 23:36
Checks AUTO_INCREMENT fields in MySQL to see if near MAXVALUE
/*
Copyright (c) 2014, Percona LLC and/or its affiliates. All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@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 / pxc_consul_master_lock.sh
Created May 18, 2017 23:05
A foreground script that constantly tries to hold a consul lock to make itself master for PXC
#!/bin/bash
MYSQL_CMDLINE="mysql -nNE --connect-timeout=5"
AVAILABLE_WHEN_DONOR=1
function getSession() {
local retry=0
local __dummy=""
@utdrmac
utdrmac / make_employees.py
Last active February 7, 2024 16:58
Multi-Threaded MySQL in Python
#!/usr/bin/python
import os, sys
import random
import time
import string
import mysql.connector
import threading
from mysql.connector import errorcode
@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 / 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
@utdrmac
utdrmac / keybase.md
Last active February 21, 2017 19:39
Keybase Proof

Keybase proof

I hereby claim:

  • I am utdrmac on github.
  • I am utdrmac (https://keybase.io/utdrmac) on keybase.
  • I have a public key ASBe9_sYtgbqJWYn6uB5b2tkVuDEvqzD3zH8Y9uJ2qTcWAo

To claim this, I am signing this object:

@utdrmac
utdrmac / queue.php
Created September 22, 2016 01:25
Test script for AWS SQS
#!/usr/bin/env php
<?php
include 'config.php';
/* This is the EC2 API Client object */
$sqs = Aws\Sqs\SqsClient::factory(array(
'key' => $aws_key,
'secret' => $aws_secret,
'region' => 'us-west-2',
@utdrmac
utdrmac / mysql_memory_usage.sql
Created June 21, 2016 19:06
MySQL Memory Usage
SELECT CONCAT((@@key_buffer_size + @@query_cache_size + (@@innodb_buffer_pool_size * 1.05 + 20*1024*1024) + @@innodb_additional_mem_pool_size + @@innodb_log_buffer_size
+ @@max_connections * (@@read_buffer_size + @@read_rnd_buffer_size + @@sort_buffer_size + @@join_buffer_size + @@binlog_cache_size + @@tmp_table_size
+ @@thread_stack)) / 1024/1024/1024, ' GB') AS "POTENTIAL MEMORY USAGE";