Skip to content

Instantly share code, notes, and snippets.

View aw's full-sized avatar

Alex Williams aw

View GitHub Profile
@aw
aw / gist:1008793
Created June 5, 2011 08:38
Simple ip_nonlocal_bind IPv6 workaround
#! /bin/sh
#
## Tested on Linux Debian 5.0 (Lenny)
#
# OK I know this is nothing new/special.
# If you've always configured your LBs a certain way, you might have to use this method instead.
#
# Scenario: High-availability setup with 2 HAProxy/Keepalived load-balancers on IPv6
#
# Problem: HAProxy won't start (cannot bind socket) because the virtual IPv6 address is not assigned
@aw
aw / mysql_consistency.sh
Created July 8, 2011 04:12
Perform consistency checks on replicated MySQL databases
#!/bin/sh
# Script to perform consistency checks on replicated MySQL databases
#
# (c) Alex Williams - 2009 - www.alexwilliams.ca
#
# v0.1
#
# Options:
# -c Check for inconsistent slaves
@aw
aw / xinetd-mysqlchk
Created July 8, 2011 04:26
xinetd script to check MySQL availability and replication status
#
# /etc/xinetd.d/mysqlchk
#
service mysqlchk_write
{
flags = REUSE
socket_type = stream
port = 9200
wait = no
user = nobody
@aw
aw / mysqlchk_status.sh
Created July 8, 2011 04:28
Check if a MySQL server is healthy
#!/bin/bash
#
# This script checks if a mysql server is healthy running on localhost. It will
# return:
#
# "HTTP/1.x 200 OK\r" (if mysql is running smoothly)
#
# - OR -
#
# "HTTP/1.x 500 Internal Server Error\r" (else)
@aw
aw / haproxy-db.conf
Created July 8, 2011 04:29
HAProxy configuration for MySQL failover and redundancy
# HAProxy configuration - haproxy-db.cfg
##
## FRONTEND ##
##
# Load-balanced IPs for DB writes and reads
#
frontend db_write
bind 172.16.0.50:3306
@aw
aw / gist:6412641
Created September 2, 2013 13:03
Linux Bonding + VLANS coming up too slowly
# You know that time where you have VLANs on a bonded interface, and it takes
# forever for the bonds to come up? (forever = ~2 minutes)..
#
# A nice fix, which requires you to set bond-master
# on your eth0/eth1 interfaces, as opposed to bond-slave
# on your bond0 interface.
# Example below:
auto eth0
@aw
aw / gist:6431511
Created September 4, 2013 00:50
FreeBSD fails installing ruby 1.9.3-pNNN
BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20130903165823.13945
Results logged to /tmp/ruby-build.20130903165823.13945.log

Last 10 log lines:
linking shared-object -test-/wait_for_single_fd/wait_for_single_fd.so
compiling modify.c
compiling set_len.c
@aw
aw / Gemfile
Created September 22, 2013 16:32
Vagrant 1.3.x as a ruby gem on FreeBSD
# Gemfile
source 'https://rubygems.org'
gem 'vagrant', :git => 'https://github.com/mitchellh/vagrant.git', :branch => 'v1.3.3'
@aw
aw / gist:6823356
Created October 4, 2013 09:29
[FIX] Amazon EC2 gateway NAT doesn't work?
# Had this crazy networking problem when trying to use an EC2 instance as a NAT gateway.
#
# Here's a fix I found buried in documentation here:
# http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html
#
Disabling Source/Destination Checks
Each EC2 instance performs source/destination checks by default. This means that the instance must be the source or destination of any traffic it sends or receives. However, a NAT instance must be able to send and receive traffic when the source or destination is not itself. Therefore, you must disable source/destination checks on the NAT instance.
@aw
aw / Makefile.patch
Created January 5, 2016 10:01
Compile 32-bit picolisp on ARM (RPi)
--- Makefile 2015-09-06 03:34:04.000000000 +0000
+++ Makefile.old 2015-09-06 03:34:33.000000000 +0000
@@ -19,10 +19,10 @@ CFLAGS = -c -O2 -pipe \
ifeq ($(shell uname), Linux)
OS = Linux
- CFLAGS += -m32
- PICOLISP-FLAGS = -m32 -rdynamic
+ #CFLAGS += -m32
+ PICOLISP-FLAGS = -rdynamic