Skip to content

Instantly share code, notes, and snippets.

# mtr --report --report-cycles 60 addons.mozilla.org
Start: Mon Aug 11 20:55:57 2014
HOST: amo-net-debug Loss% Snt Last Avg Best Wrst StDev
1.|-- 104.131.223.254 0.0% 60 0.3 2.3 0.3 14.8 3.2
2.|-- 198.199.99.233 0.0% 60 0.9 1.8 0.2 33.8 5.3
3.|-- nyk-b5-link.telia.net 0.0% 60 0.7 1.9 0.4 57.9 7.6
4.|-- nyk-bb2-link.telia.net 0.0% 60 1.1 8.6 0.8 92.2 20.8
5.|-- dls-bb1-link.telia.net 0.0% 60 45.9 45.9 45.6 50.3 0.5
6.|-- phx-b1-link.telia.net 1.7% 60 84.8 85.5 84.7 113.9 3.8
7.|-- mozilla-ic-140268-phx-b1. 1.7% 60 75.4 78.1 75.2 123.2 9.4
@oremj
oremj / golang.spec
Created July 2, 2014 16:39
Golang spec file.
%global debug_package %{nil}
%global __strip /bin/true
Name: golang
Version: 1.3
Release: 1%{?dist}
Summary: Golang
Group: Development/Languages
License: BSD
@oremj
oremj / goworkspaces.sh
Created June 6, 2014 17:43
Like python virtualenv for go.
GO_WORKSPACE=${GO_WORKSPACE:-~/Documents/work/goworkspace}
mkdir -p $GO_WORKSPACE
goworkon() {
PROJECT=$1
PROJECT_DIR="${GO_WORKSPACE}/${PROJECT}"
if [[ ! -d "$PROJECT_DIR" ]]; then
echo "Project does not exist!"
return 1
fi
@oremj
oremj / awsloadtest.py
Last active August 29, 2015 14:02
awsloadtest.py
#!/usr/bin/python
from multiprocessing import Pool
from subprocess import call, Popen
from tempfile import NamedTemporaryFile
import time
from boto import ec2
INSTANCE_NAME = 'vegeta-loadtest'
@oremj
oremj / activate_aws_env
Last active August 29, 2015 14:00
Switch between encrypted AWS environments.
# -*- mode: shell-script -*-
# source this file from your shell's rc file
activate_aws_env() {
AWS_ENV=$1
ENV_FILE="${HOME}/Dropbox/awsenvs/${AWS_ENV}.gpg"
if [ ! -f "$ENV_FILE" ]; then
echo "$ENV_FILE" does not exist.
return
fi
@oremj
oremj / mysql_filter.go
Last active August 29, 2015 14:00
mysqldump filter
package main
import (
"bufio"
"fmt"
"io"
"log"
"os"
"strings"
)
@oremj
oremj / loadtest.sh
Last active January 3, 2016 15:38
Use AWS hosts for vegeta load test.
#!/bin/bash
# assumes hosts are tagged with tag_Name_marketplace-stage-loadtest
# ansible tag_Name_marketplace-stage-loadtest -m copy -a "src=./vegeta dest=/tmp/vegeta" to copy vegeta to the load test hosts.
set -e
URL='https://marketplace.allizom.org/'
RATE=10
DURATION="1s"
@oremj
oremj / mappings_to_redirects.sh
Created January 8, 2014 19:21
Shell script mapping sdk doc "mappings" to nginx rewrites.
#!/bin/bash
set -e
for version in 23 24 25 26; do
while IFS="," read from to; do
versions=""
latest=""
for j in 23 24 25 26; do
if [ "$j" -eq "$version" ]; then
from boto.s3.connection import S3Connection
s3 = S3Connection()
bucket = s3.get_bucket('YOURBUCKET')
k = bucket.new_key('testkey')
k.set_contents_from_string('test')
@oremj
oremj / coreos-example.json
Created August 21, 2013 23:10
Creates AWS resources described in http://coreos.com/docs/ec2/
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Core ec2 example: http://coreos.com/docs/ec2/",
"Parameters": {
"InstanceType" : {
"Description" : "EC2 instance type",
"Type" : "String",
"Default" : "t1.micro",
"AllowedValues" : [ "t1.micro","m1.small","m1.medium","m1.large","m1.xlarge", "m3.xlarge", "m3.2xlarge", "m2.xlarge","m2.2xlarge","m2.4xlarge","c1.medium","c1.xlarge","cc1.4xlarge","cc2.8xlarge","cg1.4xlarge", "hi1.4xlarge", "hs1.8xlarge"],