Skip to content

Instantly share code, notes, and snippets.

#! /usr/bin/env python
"""
see: http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-DescribeInstances.html
ec2-describe.py --filter tag:ACCT_ROLE=DEVELOPMENT --format report
ec2-describe.py --filter tag:ACCT_ROLE=OPERATIONS --format report
ec2-describe.py --filter instance-type=m1.small --format report
"""
import argparse
import os
@zircote
zircote / direct_queue_routed_delay.php
Last active December 31, 2015 01:59
Rhubarb 3.2-dev use examples
<?php
/**
*
* @license http://www.apache.org/licenses/LICENSE-2.0
* Copyright [2013] [Robert Allen]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
#!/usr/bin/env python
#
# Converts any integer into a base [BASE] number. I have chosen 62
# as it is meant to represent the integers using all the alphanumeric
# characters, [no special characters] = {0..9}, {A..Z}, {a..z}
#
# I plan on using this to shorten the representation of possibly long ids,
# a la url shortenters
#
@zircote
zircote / ansible_playbook.sh
Last active December 21, 2015 04:39
Single line creation of a default ansible playbook structure
mkdir -p {group_,host_}vars \
roles/{common,webtier}/{tasks,handlers,templates,files,vars} \
role/{monitoring,myapp} && \
touch {production,stage,development,testing,{site,webservers,dbservers}.yml}
@zircote
zircote / LICENSE
Created August 7, 2013 01:14 — forked from joerayme/LICENSE
Copyright (c) 2013 Couller Ltd. and Joseph Ray
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@zircote
zircote / ping.py
Created August 6, 2013 22:31
ping stats
import argparse
import ConfigParser
import subprocess
import shlex
import re
import time
'''Ping Class to monitor arbitrary ping times
'''
@zircote
zircote / redis-stats
Last active December 20, 2015 16:29
redis statsd collection
#!/usr/bin/env python
import redis
import statsd
import time
import argparse
import logging
import sys
import os
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
BTW yum has last Redis too, remi repository at least.
$ sudo -i
$ yum list redis
$ redis.x86_64 2.6.13-1.el6.remi remi
But today we want compile redis from source (see http://redis.io/download)
$ yum install make gcc tcl
$ cd /usr/local/src
@zircote
zircote / test-before-observing.php
Created June 18, 2013 16:08
ProTip: Test the key exists before accessing the value in the switch.
<?php
switch (isset($headers['content-type']) && $headers['content-type']) {
case 'application/xml':
$format = 'XML';
break;
case 'application/json':
default:
$format = 'JSON';
}