Skip to content

Instantly share code, notes, and snippets.

View iolloyd's full-sized avatar
💭
Busy bee

Lloyd Moore iolloyd

💭
Busy bee
View GitHub Profile
@iolloyd
iolloyd / think.md
Created April 1, 2016 16:20
Thoughts on what to do with your code

What is easy | hard to alter

What can be done to make the hard stuff easier to alter

What is worth altering

What can go

What is the benefit of making a change

@iolloyd
iolloyd / logging.sql
Last active March 15, 2016 16:30
Enable mysql logging without restarting the mysql server
-- Make sure you pick somewhere you
-- have permissions to write to.
SET GLOBAL GENERAL_LOG = 'off';
SET GLOBAL GENERAL_LOG_FILE = '/Users/lloyd/mysql.log';
SET GLOBAL GENERAL_LOG = 'on';
@iolloyd
iolloyd / build-staging.sh
Created March 15, 2016 08:32
secure webhook for using git to deploy
#!/bin/sh
cd /var/www/site-staging && git reset --hard && git pull -f origin staging
echo ok
@iolloyd
iolloyd / nginx-dynamic-hosts.conf
Last active March 11, 2016 09:05
Dynamic hosts using dnsmasq
server {
index index.php;
set $base "/var/www";
set $domain $host;
# Simple
if ($domain ~ "^(.[^.]*)\.loc$") {
set $domain $1;
set $rootpath "${domain}";
set $servername "${domain}.loc";
@iolloyd
iolloyd / all_ec2_instances.py
Last active March 8, 2016 14:12
Get all available ec2 instances
import boto
from pprint import pprint
ec2 = boto.connect_ec2()
instances = [x for y in ec2.get_all_instances() for x in y.instances]
for x in instances:
pprint(x.__dict__)
@iolloyd
iolloyd / mapping.php
Created March 4, 2016 20:29
defining a relationship
<?php
namespace API\Service\Command;
use API\Service\CommandService;
class ContentCommandService extends CommandService
{
protected $hasMany = 'Asset';
protected $uses = 'ContentMapping';
@iolloyd
iolloyd / uat_format.md
Last active March 4, 2016 19:05
Test plan format for acceptance testing

Test plan

Login as an admin

Setup

Not logged in

Url lookbooks.com is open

@iolloyd
iolloyd / why_redis.md
Created January 29, 2016 21:12
Some reasons to put redis in your stack

There are a lot of articles exploring the whys and wherefores of redis and I thought I would share some thoughts from somebody well versed in redis having used it in production over the past five or six years.

Build your own tailor-made indexes.

One of the foundations of the power of relational databases is the use of indexes. Redis gives you the ability to build your own, the way you want it, in a completely visible manner.

Sub element retrieval.

@iolloyd
iolloyd / iamlloyd.py
Created January 22, 2016 07:50
My geek description
from base64 import decodestring
print decodestring("SSBhbSB0aGUgc29mdHdhcmUgZ2FyZGVuZXIsIHRoZSBjdWx0aXZhdG9yIG9mIGRpZ2l0YWwgcGxhbnRzIGFuZCB0aGUgbW93ZXIgb2YgY29kZWQgc2VlZHM=/n")
@iolloyd
iolloyd / cloud-formation-nat.js
Created January 15, 2016 08:31
VPC template including NAT
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "CloudFormation template: VPC, subnets(public, private), NAT for private network Internet access",
"Parameters": {
"KeyPairName": {
"Description": "A key pair name",
"Type": "String",