Skip to content

Instantly share code, notes, and snippets.

View aw's full-sized avatar

Alex Williams aw

View GitHub Profile
@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 / 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 / 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
@aw
aw / tc-config.patch
Created May 17, 2016 15:34
Patch for pre-boot script
diff --git a/etc/init.d/tc-config b/etc/init.d/tc-config
index f6002dd..c44876c 100755
--- a/etc/init.d/tc-config
+++ b/etc/init.d/tc-config
@@ -25,6 +25,8 @@ addUser(){
# Main
+[ -f "/opt/preboot.sh" ] && /opt/preboot.sh
+
@aw
aw / writesame.sh
Created February 10, 2017 12:56
Suppress WRITE SAME messages
# Suppress WRITE SAME messages
disks=`find /sys | grep max_write_same_blocks`
for i in $disks; do
[ -f "$i" ] && echo 0 > "$i"
done
@aw
aw / backcompat.md
Last active March 8, 2017 04:40
PicoLisp backwards compatibility hacks

This gist is meant to track backwards incompatible changes in PicoLisp, and provide simple hacks to ensure backwards compatibility with older versions.

PicoLisp v17.3.4 - March 2017

  • (local) syntax changes
  • (local) is now undefined in 32-bit
  • (local) [doesn't accept parameters in 64-bit]

HACK: