Skip to content

Instantly share code, notes, and snippets.

@yannmh
yannmh / service-checklist.md
Created August 31, 2018 14:56 — forked from alq666/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@yannmh
yannmh / lambda.py
Created July 17, 2017 18:41 — forked from mzupan/lambda.py
AWS Lambda job to backup RDS instances
import boto3
import datetime
def lambda_handler(event, context):
print("Connecting to RDS")
client = boto3.client('rds')
print("RDS snapshot backups stated at %s...\n" % datetime.datetime.now())
client.create_db_snapshot(
DBInstanceIdentifier='web-platform-slave',
@yannmh
yannmh / jq-insert-var.sh
Created July 10, 2017 17:04 — forked from joar/jq-insert-var.sh
Add a field to an object with JQ
# Add field
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {
# "hello": "world",
# "foo": "bar"
# }
# Override field value
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}'
{
@yannmh
yannmh / postgres_queries_and_commands.sql
Created June 25, 2017 15:40 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@yannmh
yannmh / gist:83d28e0a2c4b25cd5475
Created November 17, 2015 19:33 — forked from Bouke/gist:11261620
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

@yannmh
yannmh / .gitconfig
Last active August 29, 2015 14:23 — forked from LeoCavaille/.gitconfig
[alias]
checkoutpr = "!f() { git fetch origin refs/pull/$1/head:pr/$1; git checkout pr/$1; } ; f"
checkoutcontrib = "!f() { git checkout master && git pull && git remote add $1 git@github.com:$1/dd-agent && git fetch $1 $2 && git checkout -b $3 $1/$2 && git rebase master } ; f"