Skip to content

Instantly share code, notes, and snippets.

View awaddell's full-sized avatar

Alastair Waddell awaddell

View GitHub Profile

Keybase proof

I hereby claim:

  • I am awaddell on github.
  • I am awaddell (https://keybase.io/awaddell) on keybase.
  • I have a public key ASAYmyk2a4ingvP83My5x6HEr9mV_YwojKUFD6inonlwaQo

To claim this, I am signing this object:

@awaddell
awaddell / gist:cdfc0abc101675e8253b0c4693df795e
Created July 13, 2016 13:01
Remove Google Apps from Launchpad in OS X
From a Terminal
open ~/Applications
(now delete selected apps)
defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock
@awaddell
awaddell / storeImgInMongoWithMongoose.js
Last active June 19, 2016 13:40 — forked from aheckmann/storeImgInMongoWithMongoose.js
store/display an image in mongodb using mongoose/express
/**
* Module dependencies
*/
var express = require('express')
, http = require('http');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var request = require('request');
@awaddell
awaddell / rdssnapshot.sh
Last active February 15, 2016 11:02
Backup RDS automatic snapshots with manual ones that don't get deleted along with the instance
#!/bin/bash
: "${mysqlhost:?Need to set mysqlhost}"
# example JMESPath input to --query
# 'DBSnapshots[?starts_with(DBSnapshotIdentifier,`rds:mysql-master-2016-02-14`)==`true`]'
mydate=`date -u +%Y-%m-%d`
region=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/\(.*\)[a-z]/\1/'`
@awaddell
awaddell / gist:d958c9ec2347d7770954
Created February 13, 2016 08:45
cloud-init multiple files example
# from https://coreos.com/os/docs/latest/cloud-config.html
#cloud-config
write_files:
- path: "/etc/resolv.conf"
permissions: "0644"
owner: "root"
content: |
nameserver 8.8.8.8
- path: "/etc/motd"
permissions: "0644"
@awaddell
awaddell / README.md
Last active February 15, 2016 15:14 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

#!/bin/bash
# this script does not read or change the local interface at all
# its for use with a host behind NAT where the NAT device can do 6rd or 6in4 but can't update the tunnel broker
# as tunnelbroker.net don't want us to brute force their API, we leave the API update until we're sure our IPv4 address has changed
# http://www.linuxjournal.com/content/validating-ip-address-bash-script
function valid_ip()
{