Skip to content

Instantly share code, notes, and snippets.

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',
@zircote
zircote / rpoplpush
Created September 21, 2012 02:32
Redis rpoplpush example for circular queue
redis 127.0.0.1:6379> LPUSH t vox1
(integer) 1
redis 127.0.0.1:6379> LPUSH t vox2
(integer) 2
redis 127.0.0.1:6379> LPUSH t vox3
(integer) 3
redis 127.0.0.1:6379> LPUSH t vox4
(integer) 4
redis 127.0.0.1:6379> LPUSH t vox5
(integer) 5
@zircote
zircote / Ssh2Test.php
Created September 3, 2012 19:56
Functional testing php-ssh2 commands with PHPUnit and Vagrant
<?php
/**
*
*/
class Ssh2Test extends PHPUnit_Framework_TestCase
{
/**
* @var resource
*/
@zircote
zircote / ZendJobQueue.php
Last active October 7, 2015 15:48
Autocompletion file for ZendJobQueue
<?php
/**
* The ZendJobQueue is a PHP class that implements a connection to the Job Queue Daemon
*
*/
class ZendJobQueue
{
/**