Skip to content

Instantly share code, notes, and snippets.

@zircote
zircote / composer.sh
Created December 13, 2012 16:54
Got tired of finding I was not running latest composer version.
#!/bin/bash
COMPOSER=$(type -p "composer.phar")
if [ -x "${COMPOSER}" ]; then
${COMPOSER} self-update > /dev/null
else
$(type -p "php") -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
fi
${COMPOSER} $@
@zircote
zircote / cluster-members.txt
Created November 19, 2012 06:32
Pear install
[ zircote ~/Workspace/Jazsl ] zf cluster-status jazsl-server zcsm
Cluster Members:
┌──────────┬───────────────┬───────────────┬────────────────────────────────────────────────────────────┐
│Server ID │Status │Instance-Name │URI │
├──────────┼───────────────┼───────────────┼────────────────────────────────────────────────────────────┤
│25 │OK │i-07982fff │ec2-00-00-00-01.compute-1.amazonaws.com │
├──────────┼───────────────┼───────────────┼────────────────────────────────────────────────────────────┤
│28 │OK │i-25765fff │ec2-00-00-00-00.compute-1.amazonaws.com │
├──────────┼───────────────┼───────────────┼────────────────────────────────────────────────────────────┤
│31 │OK │i-2e988fff │ec2-00-00-00-00.us-west-1.compute.amazonaws.com │
@zircote
zircote / ec2_name.sh
Created November 16, 2012 18:26
Route53 Hostname Injection
#!/bin/bash
#
# @c Robert Allen [email protected]
#
# /usr/bin/ec2_name
if [ -f /etc/profile.d/aws-apitools-common.sh ]; then
. /etc/profile.d/aws-apitools-common.sh
export PATH=/opt/aws/bin:$PATH
fi
Writing System V init scripts for Red Hat Linux
===============================================
All System V init scripts are named /etc/rc.d/init.d/<servicename>
where <servicename> is the name of the service. There must be no
".init" suffix.
This path will very likely be moved to /etc/init.d in the future.
Once Red Hat Linux 7.0 is installed, you can access scripts as
/etc/init.d/<servicename>, via symlinks.
@zircote
zircote / attributes.default.rb
Created November 11, 2012 06:37
AWS Route53 Hostname manipulation Chef Cookbook (needs more time and tests but is working as desired with VPC)
# cluster identifier
default[:route53][:zone] = "my.default-domain.com"
@zircote
zircote / route53-hostname-from-tag.sh
Created November 10, 2012 22:16
Grabs the hostname from the Name Meta-tag, if it has the zone in it, it is striped and added to route53. If it is on a VPC it CNAMES the private IP otherwise the public hostname.
#!/bin/bash
ZONE="my.route53-dnszone.com"
test_local="$(curl --write-out %{http_code} --silent --output \
/dev/null http://169.254.169.254/latest/meta-data/public-hostname)"
if [ "200" = "$test_local" ]; then
CNAME="$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)"
else
CNAME="$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)"
fi
HOSTNAME="$(ec2-describe-tags \
@zircote
zircote / tasks.py
Created November 6, 2012 17:26
Recursive S3 RRS with Celery
import boto, logging, os, sys, re, awscreds
from celery import Celery
from celery.utils.log import get_task_logger
from boto.s3.connection import S3ResponseError
def searchDirs():
import shlex, subprocess
command = "find %s -maxdepth 4 -mindepth 4 -type d " % root_path;
args = shlex.split(command)
process = subprocess.Popen(args, stdout=subprocess.PIPE)
@zircote
zircote / swagger.json
Created November 5, 2012 12:01
Swagger-PHP with Doctrine Annotations Output
{
"/pet":{
"apiVersion":"0.2",
"swaggerVersion":"1.1",
"basePath":"http://petstore.swagger.wordnik.com/api",
"resourcePath":"/pet",
"apis":[
{
"path":"/pet.{format}/{petId}",
"description":"Operations about pets",
@zircote
zircote / Log_Writer_Amqp.php
Created September 21, 2012 19:38
A zend_log writer for AMQP
<?php
/**
* @package
* @category
* @subcategory
*/
/**
* @package
* @category
* @subcategory
@zircote
zircote / zend_mail_example.php
Created September 21, 2012 14:39
Zend_Mail with inline Zend_Mime_Part
<?php
require_once 'Zend/Mail.php';
require_once 'Zend/Mime/Part.php';
require_once 'Zend/Mail/Transport/Smtp.php';
$config = array(
'name' => 'smtp.gmail.com',
'auth' => 'login',