Skip to content

Instantly share code, notes, and snippets.

@zircote
zircote / MongoDB.php
Created November 15, 2011 21:10
A MongoDB completion resource for an IDE of your choice.
<?php
/* Core Classes */
class Mongo
{
/**
*
*
* @var string
*/
const VERSION = '';
@zircote
zircote / ErrorController.php
Created October 25, 2011 12:56
Introspection for ACL resource->role mapping.
<?php
class ErrorController extends Zend_Controller_Action
{
/**
* @aclRole annonymous
* @aclRole admin
*/
public function errorAction()
{
}
@zircote
zircote / create-attach-ebs.sh
Created October 2, 2011 00:01
Create and Attach EBS volumes for 1TB RAID 1+0
#!/bin/sh
EC2_INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
EC2_AVAIL_ZONE=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone`
EC2_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
EBS_SIZE=256
for x in {1..8}; do \
ec2-create-volume -s $EBS_SIZE -z $EC2_AVAIL_ZONE ; \
done > /tmp/vols.txt
@zircote
zircote / ssh.sh
Created September 26, 2011 21:45
Convert a AWS PEM into a ssh pub key
ssh-keygen -y -f private_key1.pem > public_key1.pub
@zircote
zircote / Bayuex.php
Created July 27, 2011 21:32
BayueX Client for PHP utlizing Zend_Service_Abstract
<?php
require_once 'Zend/Service/Abstract.php';
require_once 'Zend/Json.php';
/**
* A PHP CometD Publisher
* @author zircote / Robert Allen
* Publishing:
* <code>
* $bayuex = new Bayuex('http://localhost:8080');
* $i = 0;
@zircote
zircote / prowl-logging.php
Created July 2, 2011 22:30
A Prowl Log Writer for Zend_Log
<?php
$prowl = array(
'apikey' => '072a7159e...e36ebe57',
// 'apikey' => array('072a7159e...e36ebe57','072a7159e...e36ebe57','072a7159e...e36ebe57'), //for multi-keys
'priority' => Skulk_Client_Message::PRIORITY_EMERGENCY, // optional
'url' => 'http://www.zircote.com/admin/console', // optional url to forward the user to.
'event' => 'Error logging via Prowl with Zend_Log', // optional Your message header
// 'providerkey' => '072a7159e9e8f......e7765cd11c229e36ebe57' // optional
);
@zircote
zircote / PrivateIPAssertion.php
Created June 13, 2011 06:00
Private IP address Zend_Acl Assertion
<?php
require_once 'Zend/Acl/Assert/Interface.php';
/**
*
* Assert the REMOTE_ADDR of the reqeust is from a private IP address
* @author zircote
*
*/
class PrivateIPAssertion implements Zend_Acl_Assert_Interface
{
@zircote
zircote / Model_BugsServiceAcl.php
Created June 10, 2011 16:01
Redis/Rediska Backed Zend_Acl Container
<?php
/**
*
* This could be a mechanism that builds acl lists from the database or file
* based storage.
* @author zircote
*
*/
class Model_BugsServiceAcl
{
@zircote
zircote / Api.php
Created June 4, 2011 14:16
Unit Testing Web-Services With Zend Framework
<?php
class Api extends Zend_Http_Client
{
/**
*
* @group Account
*/
public function accountStatus()
{
@zircote
zircote / Jeffe.php
Created June 3, 2011 18:49
Rediska Worker/Queue Pair for Recurring Tasks
<?php
$options = array('namespace' => 'WorkerProcess_',
'servers' => array(array('host' => '127.0.0.1', 'port' => 6380)));
/* el Jeffe */
$redis = new Rediska($options);
while (true) {
$first_url = $redis->popFromListBlocking(SRC_QUEUE, 0, SRC_QUEUE);
if($first_url){
$redis->appendToList(WORK_QUEUE, $first_url);
}