Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
_DEBUG="on"
DEBUGFILE=/tmp/sentinel_failover.log
VIP='10.125.125.30'
MASTERIP=${6}
MASK='26'
IFACE='eth0'
MYIP=$(ip -4 -o addr show dev ${IFACE}| grep -v secondary| awk '{split($4,a,"/");print a[1]}')
DEBUG () {
@dayreiner
dayreiner / backup-github.sh
Last active November 12, 2015 15:04 — forked from rodw/backup-github.sh
A simple script to backup an organization's GitHub repositories, wikis and issues. Forked to add pagination support as my org has more repos than the original can handle.
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=${GHBU_ORG-"<CHANGE-ME>"} # the GitHub organization whose repos will be backed up
# (if you're backing up a user's repos instead, this should be your GitHub username)
GHBU_UNAME=${GHBU_UNAME-"<CHANGE-ME>"} # the username of a GitHub account (to use with the GitHub API)
GHBU_PASSWD=${GHBU_PASSWD-"<CHANGE-ME>"} # the password for that account
GHBU_GITHOST=${GHBU_GITHOST-"github.com"} # the GitHub hostname (see comments)
GHBU_PRUNE_OLD=${GHBU_PRUNE_OLD-true} # when `true`, old backups will be deleted
@dayreiner
dayreiner / zero-to-mariadb+swarm-in-15-minutes-softlayer.md
Last active March 31, 2016 01:43
Part one of a two-part series on building a high-availability containerized MariaDB Galera cluster on top of a multi-master docker swarm in the cloud.

Reposted from this blog entry

Multicolored Containers Photo By: Håkan Dahlström

Part one of a two-part series. The second part will be posted in a couple of days...

While I manage environments across multiple cloud platforms (and even the occasional "traditional" colo) at my workplace, our primary application environment is in IBM Softlayer. I enjoy working with Softlayer -- the API is fairly robust, there's a lot of choice (even bare-metal, should that tickle your fancy) and it allows me to deploy instances in both Toronto and Montreal. Canadian data-residency is a "big deal" for many Canadian companies; which the

Keybase proof

I hereby claim:

  • I am dayreiner on github.
  • I am dayreiner (https://keybase.io/dayreiner) on keybase.
  • I have a public key whose fingerprint is C9B8 3E33 457A 7E82 52BA 1D32 8800 AEA0 322E A3E2

To claim this, I am signing this object:

@dayreiner
dayreiner / example-compose-mariadb-galera.yml
Last active April 5, 2017 15:50
Example compose file for a test galera cluster on a single host, as part of an answer to this Stack Exchange: http://stackoverflow.com/questions/41573048/how-to-debug-wsrep-sst-failed-1-operation-not-permitted-with-a-mariadb-gal/41622952#41622952
version: '2'
services:
db-bootstrap:
image: dayreiner/centos7-mariadb-10.1-galera:latest
container_name: db1
restart: never
expose:
- "3306"
- "4567"
- "4568"
@dayreiner
dayreiner / docker-1.10.0-rc1-xhyve-osx-install.md
Last active November 9, 2020 13:48
HOWTO: Docker 1.10.0-rc1 on OSX El Capitan with docker-compose 1.6.0-rc1 and docker-machine 0.6.0-rc1. Use Xhyve driver instead of virtualbox for performance.

Docker 1.10.0 RC1 with Docker Compose 0.6 and Docker Machine 1.6 and Xhyve on OSX

Updated install instructions for RC2 are available here

docker

The steps below will uninstall docker, docker-machine and docker-compose under OSX using virtualbox (via either brew or toolbox, or both), and replace them with the latest RC versions of docker, compose and machine using the Xhyve driver for better performance under OSX using Hypervisor.framework.

@dayreiner
dayreiner / monitor-galera-status-citrix-netscaler.md
Last active December 10, 2020 18:56
Monitoring MariaDB / MySQL Galera cluster status with Citrix Netscaler

Monitoring MariaDB Galera Cluster Members with Citrix Netscaler

Also posted here: http://18pct.com/monitoring-mariadb-galera-cluster-members-with-citrix-netscaler/

We run several MariaDB Galera clusters for various client sites and use Citrix Netscaler Application Delivery Controllers to load-balance various services (among other features). With near-synchronous multimaster replication, Galera cluster simplifies application stacks as in many cases you can point each web server at its own corresponding database server and just worry about balancing the load between your application servers.

Citrix netscaler also supports load-balancing across MySQL systems, for instances where you want to spread out reads across systems or want to balance reads and send writes to a specific system.

But what happens when

@dayreiner
dayreiner / icinga2_check_wmi_plus.conf
Created June 11, 2015 21:19
An example check_wmi_plus configuration for Icinga2. Check_wmi_plus (http://www.edcint.co.nz/checkwmiplus/) is a clientless plugin for monitoring Windows systems via WMI with Nagios and other monitoring platforms.
object CheckCommand "check_wmi" {
import "plugin-check-command"
command = [ PluginDir + "/check_wmi_plus.pl" ]
arguments = {
"--inidir" = "$wmi_inidir$"
"-H" = "$host.name$"
"-A" = "$wmi_authfile_path$"
"-m" = "$check_mode$"
"-s" = "$wmi_submode$"
@dayreiner
dayreiner / docker-1.10.0-rc3-xhyve-osx-install.md
Last active May 10, 2022 08:02
HOWTO: Docker 1.10.0-rc3 on OSX El Capitan with docker-compose 1.6.0-rc2 and docker-machine 0.6.0-rc3. Use Xhyve driver instead of virtualbox for performance.
@dayreiner
dayreiner / gtin_generate_check_digit_and_case_code.sql
Created September 28, 2022 01:34
Example MariaDB database for storing product GTINs and automatically generating the GS1 check digit and GTIN Master Case Code
--
-- @dayreiner | https://18pct.com/ | https://sensibrands.ca | https://github.com/dayreiner
--
-- An example database for storing product GTINs and generating the GS1 check digit and GTIN master case code.
-- When an 11-digit GTIN is inserted, a trigger calls the function to generate the GS1 check digit and insert it into the check_digit column.
-- A second trigger generates the master case code GTIN and inserts that value in the master_case_code column.
-- Expanded upon from the function in this article: https://www.anycodings.com/1questions/4958850/check-for-invalid-upc-in-mysql
--
-- After creating the gtin database, you can insert a gtin to test that the check digit and case code are correctly added:
--