Skip to content

Instantly share code, notes, and snippets.

wget -O /opt/cw.zip http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip
unzip /opt/cw.zip -d /opt/
rm -f /opt/cw.zip
yum install -y openssl openssl-devel perl-ExtUtils-MakeMaker
curl -L http://cpanmin.us | perl - --self-upgrade
cpanm Digest::SHA Bundle::LWP5_837 LWP LWP::Protocol::https
IAM_ROLE=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/`
DISK_PARAM=`mount |grep -E '[s|xv]d|mapper' | awk '{print "--disk-path="$3}' | tr '\n' ' '`
/* This is a Mono tool, for checking if an SSLv3
* certificate can be used for Server validation
* during an SSLv3 handshake
*
* Compile with:
* gmcs -r:Mono.Security certcheck.cs
*
* Usage:
* mono certcheck.exe /path/to/acertfile.cer
* */
var
PARALLEL_CONNECTS = 10,
http = require('http'),
sys = require('sys'),
connectionCount = 0,
messageCount = 0;
lastMessages = 0;
function addClient() {
@coolaj86
coolaj86 / cors.js
Created October 29, 2010 08:41
CORS / XHR2 middleware for Node.js
/*
Here's some documentation on XMLHttpRequest Level 1 and 2 as per the
standard and as per implementation.
XHR
http://www.w3.org/TR/XMLHttpRequest/
http://developer.apple.com/internet/webcontent/xmlhttpreq.html
http://msdn.microsoft.com/en-us/library/ms535874%28VS.85%29.aspx
XHR2
@garethr
garethr / amqpserver.feature
Created November 21, 2010 17:35
using cucumber for monitoring AMQP server
Feature: AMQP capacity
To make sure the rest of the system is in order
Our message queues must not be backed up
Scenario: Check queue status
Given I have a AMQP server on example.com
And I want to check on the fork queue
Then it should have less than 400 messages
Then it should have at least 5 consumers
Then it should have less than 50 messages per consumer
@jamesbjackson
jamesbjackson / client.js
Created November 4, 2011 13:29 — forked from erichocean/client.js
node.js load testing client
var
PARALLEL_CONNECTS = 10,
http = require('http'),
sys = require('sys'),
connectionCount = 0,
messageCount = 0;
lastMessages = 0;
function addClient() {
@jamesbjackson
jamesbjackson / html5video.sh
Created February 14, 2012 11:49 — forked from markupboy/html5video.sh
automated conversion of a file to all three html5 compatible video formats - h.264, ogg, and webm
#!/bin/sh
####################################
# Output file for HTML5 video #
# Requirements: #
# - handbrakecli #
# - ffmpeg #
# - ffmpeg2theora #
# #
# usage: #
@jamesbjackson
jamesbjackson / gist:3091675
Created July 11, 2012 16:54 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@jamesbjackson
jamesbjackson / express_csrf
Created August 3, 2012 13:38 — forked from pomidor24/express_csrf
nodejs express smart csrf pseudo code
User's session has a fixed size pool of tokens. New token is generated every X minutes and becomes invalid every Y minutes. You always return the most recent one and check against all tokens you have.
token_valid = 180 min
create_new_token_every = 60 min
size = 3
pool = [] // your session pool
current_version = '1'
getToken = function() {
@jamesbjackson
jamesbjackson / gist:3334807
Created August 12, 2012 22:00 — forked from iand/gist:2956833
Plotinum Example
package main
import (
"code.google.com/p/plotinum/plot"
"code.google.com/p/plotinum/vg"
"code.google.com/p/plotinum/vg/veceps"
"math/rand"
)
func main() {