Skip to content

Instantly share code, notes, and snippets.

@alex-ethier
alex-ethier / schema.erl
Created July 4, 2014 01:47
Schema Validation
-define(TEST_PAYLOAD_HTTP_JSON, <<"{\"version\": \"0.0.1\", \"description\": \"cookbook update\", \"notification_type\": \"http\", \"timestamp\": \"2014-06-05T10:52Z\", \"delivery_options\": {\"url\": \"http://blah.com/updates\"}, \"type\": \"notification\", \"id\": \"04ab8499-0188-11e4-a7f5-8438354265f6\", \"data\": {\"organization_name\": \"foobarorg\", \"requestor_type\": \"user\", \"task\": \"update\", \"parent_name\": \"redis\", \"entity_name\": \"2.3.1\", \"recorded_at\": \"timestamp\", \"parent_type\": \"cookbook\", \"entity_type\": \"version\", \"requestor_name\": \"fooman\"}}">>).
-define(TEST_PAYLOAD_HTTP, {[{<<"type">>, <<"notification">>},
{<<"version">>, <<"0.0.1">>},
{<<"id">>, <<"04ab8499-0188-11e4-a7f5-8438354265f6">>},
{<<"timestamp">>, <<"2014-06-05T10:52Z">>},
{<<"notification_type">>, <<"http">>},
{<<"description">>, <<"cookbook update">>},
@alex-ethier
alex-ethier / amqp_gen_consumer.log
Created May 30, 2014 04:29
amqp_gen_consumer trace
21:13:21.668940 <0.92.0> amqp_gen_consumer:handle_call/3 --> {reply,ok,
{state,
amqp_selective_consumer,
{state,
{dict,1,16,
16,8,80,48,
{[],[],[],[],
[],[],[],[],
[],[],[],[],
[],[],[],[]},
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
# Makefile for a go project
#
# Author: Jon Eisen
# site: joneisen.me
#
# Targets:
# all: Builds the code
# build: Builds the code
# fmt: Formats the source files
# clean: cleans the code
```
alex@amba001:~/workspace/dev/tower3/ops/aws-ami-tools $ rake cloud:aws:instances:ssh_command[10] tags="Name:*worker*prod2*" command="tail -n 1000 /var/log/tower3/worker-service.log | grep ERROR" as_user="ubuntu"
[ec2-54-205-68-127.compute-1.amazonaws.com] 2013-11-08 21:02:21,996 - ERROR - worker:25044, queueId:668ddc61-3320-4ff5-9d91-03c17d6b0904, jobId:1b72bc40-67a8-4a9d-b070-b4b8dd78f314, action:failed, error:fetch-error, errorMsg:HTTP Error 404: Not Found, bot:fileio
[ec2-54-205-68-127.compute-1.amazonaws.com] 2013-11-08 21:04:45,562 - ERROR - worker:25046, queueId:668ddc61-3320-4ff5-9d91-03c17d6b0904, jobId:d7ff5b74-68e8-49f6-81fc-58d67381c06d, action:failed, error:invalid-job, errorMsg:{'operation.params': 'need sizeX and sizeY'}, bot:fileio
[ec2-54-205-68-127.compute-1.amazonaws.com] 2013-11-08 21:05:15,580 - ERROR - worker:25044, queueId:668ddc61-3320-4ff5-9d91-03c17d6b0904, jobId:1d902c3a-07a9-43ba-b936-e15654bc6f9b, action:failed, error:invalid-job, errorMsg:{'operation.params': 'need sizeX and s
@alex-ethier
alex-ethier / oauth-requests.py
Created October 25, 2012 22:32
oauth request
import requests
from requests.auth import OAuth1
import json
client_key = u'9fac88f8645bdfbd6f8a68f60c5130d082244a8a8787674e82e85f68ff3716b8'
client_secret = u'bc0cd9097930832c6308e76ae3600b8d4aff47d2190df4960abc35208d291fc0'
headeroauth = OAuth1(
client_key,
@alex-ethier
alex-ethier / git_svn_bash_prompt.sh
Created October 9, 2012 01:36 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to git/svn branch, and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
# USAGE:
@alex-ethier
alex-ethier / couchbase-insert.py
Created September 28, 2012 22:22
Couchbase python lib profiling (couchbase==0.8.0)
from couchbase.client import Couchbase
def profile_insert_doc():
couchbase = Couchbase(
"localhost:8091",
"default", ""
)
bucket = couchbase["default"]
key = "test_key"
@alex-ethier
alex-ethier / test_add_cb.py
Created September 19, 2012 00:50
couchbase perf tests
from couchbase.client import Couchbase
def insert_doc():
couchbase = Couchbase("localhost:8091", "account", "")
bucket = couchbase["account"]
key = "test_key"
val = "test_val"
bucket.set(key, 0, 0, val)
var Mongolian = require("mongolian")
var server = new Mongolian
var db = server.db("myDatabaseName")
var myCollectionName = db.collection("myCollectionName")