Skip to content

Instantly share code, notes, and snippets.

View mythmon's full-sized avatar

Michael Cooper mythmon

View GitHub Profile
@mythmon
mythmon / carafe.css
Last active December 21, 2015 04:39
Carafe is an attempt to make a set of reusable graphs for SUMO.
We couldn’t find that file to show.
@mythmon
mythmon / james.py
Last active December 20, 2015 23:58
james.py is a way of calling Chief from the command line.
#!/usr/bin/env python
"""
james.py - Chief CLI.
USAGE: james.py ENV REF
ENV - Environment defined in the config file to deploy to.
REF - A git reference (like a SHA) to deploy.
Config: james.ini in the current directory should be an ini file with
one section per environment. Each environment should have a
@mythmon
mythmon / .venv
Created August 12, 2013 17:16
Automatic environment set up and tear down. A zsh hook looks for .venv files and activates/deactivates them upon entering/leaving a directory.
#!/bin/bash
DIR=$(dirname $0)
REDISBIN="/usr/bin/redis-server"
REDISCONF="configs/redis-mine"
source $DIR/bin/activate
v_activate() {
MANAGE="${VIRTUAL_ENV}/manage.py"
function r() {
@mythmon
mythmon / sumo_db_import.sh
Created August 9, 2013 17:23
This is the script I use to set import a large database dump. It goes faster than simply piping into mysql.
#!/bin/bash
SCHEMA="support_mozilla_com.2013.07.17.schema.sql"
DATA="support_mozilla_com.2013.07.17.data.sql"
SIZE="$(du $DATA | awk '{ print $1 }')K"
DBNAME="kitsune"
{
echo "Dropping/creating database ${DBNAME}" >&2
echo "DROP DATABASE IF EXISTS ${DBNAME};"
{"builds":[{"duration":578568,"number":198,"result":"SUCCESS","timestamp":1374184988859},{"duration":414545,"number":197,"result":"SUCCESS","timestamp":1373918959798},{"duration":252481,"number":196,"result":"SUCCESS","timestamp":1373478927006},{"duration":183509,"number":195,"result":"SUCCESS","timestamp":1372807739642},{"duration":595077,"number":194,"result":"FAILURE","timestamp":1372807024854},{"duration":842581,"number":193,"result":"SUCCESS","timestamp":1371059795042},{"duration":560543,"number":192,"result":"SUCCESS","timestamp":1370555422009},{"duration":229139,"number":191,"result":"SUCCESS","timestamp":1370452301412},{"duration":233540,"number":190,"result":"SUCCESS","timestamp":1370448591797},{"duration":143113,"number":189,"result":"SUCCESS","timestamp":1370447997813},{"duration":166505,"number":188,"result":"SUCCESS","timestamp":1370446914222},{"duration":121742,"number":187,"result":"SUCCESS","timestamp":1370380485451},{"duration":818118,"number":186,"result":"SUCCESS","timestamp":1370368955207}
{"builds":[{"duration":2530240,"number":2613,"result":"SUCCESS","timestamp":1374680269083},{"duration":1455894,"number":2612,"result":"UNSTABLE","timestamp":1374677061699},{"duration":992985,"number":2611,"result":"SUCCESS","timestamp":1374609889822},{"duration":1394363,"number":2610,"result":"SUCCESS","timestamp":1374548338925},{"duration":1341192,"number":2609,"result":"SUCCESS","timestamp":1374546997340},{"duration":1161803,"number":2608,"result":"SUCCESS","timestamp":1374528273332},{"duration":1316024,"number":2607,"result":"SUCCESS","timestamp":1374514097185},{"duration":1043677,"number":2606,"result":"SUCCESS","timestamp":1374508085958},{"duration":891902,"number":2605,"result":"SUCCESS","timestamp":1374246431559},{"duration":904377,"number":2604,"result":"SUCCESS","timestamp":1374245527121},{"duration":2008539,"number":2603,"result":"SUCCESS","timestamp":1374175008375},{"duration":3145292,"number":2602,"result":"SUCCESS","timestamp":1374171862709},{"duration":1617692,"number":2601,"result":"SUCCESS","t
function coolGraph(opts) {
// Since d3 doesn't like prototype style...
var me = {
foo: makeChainableGetterSetterWithDefault('foo'),
bar: makeChainableGetterSetterWithDefault('bar')
};
// Obviously you could do that in a loop if you have a lot of properties, and
// that function name is pretty gross, a better name might be `property`.
// Now that the object is set up, this will loop through everything in `opts`, and call the right setter on `me`.
[Unit]
Description=ElasticSearch
After=network.target
[Service]
User=elasticsearch
ExecStart=/opt/elasticsearch/bin/elasticsearch -f
[Install]
WantedBy=multi-user.target
import time
import random
import sys
from copy import deepcopy
from blessings import Terminal
WIDTH = 6
HEIGHT = 4
(crimson)130@seaborgium> mocha -R list
․ testConfig should have a port: 0ms
․ mockHttp request should return a response with headers: 1ms
․ mockHttp request should return the right content type for gifs: 2ms
․ mockHttp request should return the right content type for pngs: 1ms
․ mockHttp request should return the right content type for html: 1ms
․ mockHttp request should return a 302 when requested: 1ms
․ mockHttp request should return a 404 when requested: 2ms
․ mockHttp request should return a frame denying page when requested: 1ms