Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew utdrmac

  • Percona, LLC
  • Somewhere, USA
View GitHub Profile
@utdrmac
utdrmac / headcheck.py
Created Sep 29, 2019
check current block head level from multiple sources
View headcheck.py
#!/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 = [
View dns-blacklist.sh
#!/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
@utdrmac
utdrmac / imdb_comments.py
Last active Mar 20, 2020
Insert english-like comment strings
View imdb_comments.py
#!/usr/bin/env python36
import random
import _mysql
rnouns = ["ability","abroad","abuse","access","accident","account","act","action","active","activity","actor","addition","address","administration","adult","advance","advantage","advice","affair","affect","afternoon","age","agency","agent","agreeme
nt","air","airline","airport","alarm","alcohol","alternative","ambition","amount","analysis","analyst","anger","angle","animal","annual","answer","anxiety","anybody","anything","anywhere","apartment","appeal","appearance","apple","application","app
ointment","area","argument","arm","army","arrival","art","article","aside","aspect","assignment","assist","assistance","assistant","associate","association","assumption","atmosphere","attack","attempt","attention","attitude","audience","author","av
erage","award","awareness","baby","back","background","bag","bake","balance","ball","band","bank","bar","base","baseball","basis","basket","bat","bath","bathroom","battle","beach","bear","beat","beautiful","bed","bedroom","
View imdb_workload.lua
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" }
@utdrmac
utdrmac / mysql_autoinc_checker.go
Created Apr 12, 2018
Checks AUTO_INCREMENT fields in MySQL to see if near MAXVALUE
View mysql_autoinc_checker.go
/*
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 Apr 11, 2018
Create SET-based data for MySQL testing
View make-sets.py
#!/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
A foreground script that constantly tries to hold a consul lock to make itself master for PXC
View pxc_consul_master_lock.sh
#!/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 Oct 18, 2020
Multi-Threaded MySQL in Python
View make_employees.py
#!/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 Dec 29, 2016
Monitor UPS status and graph using RRD
View collect_router_stats.py
#!/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 Jun 12, 2017
Managing SSH with pushbullet
View pushbullet_ssh.sh
#!/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
You can’t perform that action at this time.