Skip to content

Instantly share code, notes, and snippets.

View mbabineau's full-sized avatar

Mike Babineau mbabineau

  • Second Measure
  • San Francisco, CA
View GitHub Profile
#!/usr/bin/python
#
# Example code for specifying multiple dimensions in a
# query of Amazon EC2 CloudWatch using the boto library.
#
# Boto may be downloaded here: http://code.google.com/p/boto
from datetime import datetime, timedelta
from boto import connect_cloudwatch
from boto.ec2.cloudwatch.metric import Metric
# ssh-instance - function to let you SSH to an EC2 instance ID
# Written by Mike Babineau <michael.babineau@gmail.com>. Original here: https://gist.github.com/mbabineau/319882/
# Put this in ~/.profile and reload your terminal
function ssh-instance() {
if [ $# -lt 1 ] || [ $# -gt 3 ]; then
echo "Usage: ssh-instance [-r region] <instance id>"
else
case "$1" in
"-r")
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.cascade.js"></script>
<script type="text/javascript" src="/static/js/jquery.templating.js"></script>
<script type="text/javascript">
// Set up dropdown menu items for Cascade
var az_list = [
{'When':'AZ','Value':'Phoenix','Text':'Phoenix'},
{'When':'AZ','Value':'Tucson','Text':'Tucson'},
@mbabineau
mbabineau / knife.rb
Created February 21, 2011 02:29 — forked from jbz/knife.rb
# This knife.rb orig. provided by jtimberman@opscode.com - but any mistakes are mine!
current_dir = File.dirname(__FILE__)
platform = "https://api.opscode.com/organizations"
require 'grit'
branch = Grit::Repo.new("#{current_dir}/..").head.name
case branch
import datetime
import urllib2
from jabberbot import JabberBot, botcmd
import boto
class EA2DJabberBot(JabberBot):
def __init__(self, *args, **kwargs):
super(EA2DJabberBot, self).__init__(*args, **kwargs)
@mbabineau
mbabineau / delayQueueService.groovy
Last active December 12, 2015 09:39
Redis-backed delay queue as a Grails service
import redis.clients.jedis.Jedis
/**
* Handles the delaying of queued messages for later retrieval.
* See http://blog.mikebabineau.com/2013/02/09/delay-queues-in-redis/
*/
class DelayQueueService {
def redisService
/**
@mbabineau
mbabineau / docker-registry.template.json
Last active July 3, 2018 13:34
Docker Registry CloudFormation template (better version here: https://github.com/mbabineau/cloudformation-docker-registry)
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Launches a Docker Registry.",
"Parameters" : {
"InstanceType" : {
"Description" : "EC2 instance type",
"Type" : "String",
"Default" : "m1.small",
$ grep eda431d7-4a74-11e4-a320-56847afe9799 /var/log/mesos/mesos-slave.INFO
I1002 20:44:39.176024 1528 slave.cpp:1002] Got assigned task serialization.eda431d7-4a74-11e4-a320-56847afe9799 for framework 20140919-224934-1593967114-5050-1518-0000
I1002 20:44:39.176257 1528 slave.cpp:1112] Launching task serialization.eda431d7-4a74-11e4-a320-56847afe9799 for framework 20140919-224934-1593967114-5050-1518-0000
I1002 20:44:39.177287 1528 slave.cpp:1222] Queuing task 'serialization.eda431d7-4a74-11e4-a320-56847afe9799' for executor serialization.eda431d7-4a74-11e4-a320-56847afe9799 of framework '20140919-224934-1593967114-5050-1518-0000
I1002 20:44:39.191769 1528 docker.cpp:743] Starting container '1d337fa3-8dd3-4b43-9d1e-a774cbcbc22f' for task 'serialization.eda431d7-4a74-11e4-a320-56847afe9799' (and executor 'serialization.eda431d7-4a74-11e4-a320-56847afe9799') of framework '20140919-224934-1593967114-5050-1518-0000'
I1002 20:44:43.707033 1521 slave.cpp:1278] Asked to kill task serialization.eda431d7-4a74-11
@mbabineau
mbabineau / babelchart-example.py
Created August 3, 2015 19:26
babelchart example
import datetime
import json
import boto
import requests
from flask import Flask, render_template
from babelchart.sources.cloudwatch import CloudWatchSource
from babelchart.sinks.googlecharts import GoogleChartsSink
from babelchart.sources.graphite import GraphiteSource