Skip to content

Instantly share code, notes, and snippets.

@c1freitas
c1freitas / service-checklist.md
Created March 3, 2020 00:21 — forked from acolyer/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?
@c1freitas
c1freitas / refresh.sh
Created March 26, 2019 15:44 — forked from jmound/refresh.sh
Bash function to refresh all pods in all deployments by namespace
# based on the "patch deployment" strategy in this comment:
# https://github.com/kubernetes/kubernetes/issues/13488#issuecomment-372532659
# requires jq
# $1 is a valid namespace
function refresh-all-pods() {
echo
DEPLOYMENT_LIST=$(kubectl -n $1 get deployment -o json|jq -r .items[].metadata.name)
echo "Refreshing pods in all Deployments"
for deployment_name in $DEPLOYMENT_LIST ; do
@c1freitas
c1freitas / profile.go
Created January 6, 2017 14:29 — forked from jessedearing/profile.go
Have go dump a stack trace on USR1
package main
import (
"os"
"os/signal"
"runtime/pprof"
"syscall"
)
func main() {
@c1freitas
c1freitas / backup.spec.js
Last active December 6, 2016 14:50
This is a stubbed out example of patching the S3 putObject method for local unit test
// Stubbed example of Mocking a s3 putObject call
// Assumes the Backup object has an S3 property used during save function
// Stub the s3 so we can execute a local unit test
const backup = new Backup();
backup.s3 = new AWS.S3();
backup.s3.putObject = sinon.stub();
backup.s3.putObject.yields(undefined, {});
backup.save("bucketPath", testManifest).then(() => {
expect(backup.s3.putObject.callCount).to.equal(1);
@c1freitas
c1freitas / Makefile
Created October 6, 2016 03:13 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@c1freitas
c1freitas / cloud-config node-01
Created April 28, 2016 18:50 — forked from l337ch/cloud-config node-01
kubernetes flannel troubleshooting
#cloud-config
---
write_files:
- path: /opt/bin/wait4ectd.sh
owner: root
content: |
#! /usr/bin/bash
until curl http://172.16.1.101:4001/v2/machines; do sleep2; done
- path: /opt/bin/wait4apiserver.sh
@c1freitas
c1freitas / gulptask.js
Created May 28, 2015 22:53
Builds, tags, publishes npm modules in sub-directories.
// dependencies
var gulp = require('gulp'),
git = require('gulp-git'),
bump = require('gulp-bump'),
filter = require('gulp-filter'),
tag_version = require('gulp-tag-version'),
path = require('path'),
fs = require('fs');
var install = require('gulp-install');