Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew utdrmac

View GitHub Profile
View speedtest.chart.py
# -*- 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 / headcheck.py
Created September 29, 2019 15:18
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 March 20, 2020 20:15
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" }
View addpeers.sh
#!/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
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 April 11, 2018 17:34
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 23:05
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 March 3, 2023 17:06
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