Skip to content

Instantly share code, notes, and snippets.

pip install apache-airflow-providers-google
pip install apache-airflow-providers-apache-beam
resource "google_storage_bucket" "test-expiring-bucket" {
name = "test-expiring-bucket"
location = "US"
lifecycle_rule {
condition {
age = 30
}
action {
type = "Delete"
[
{
"constraint": "GCPEnforceLabelConstraintV1.require_labels",
"constraint_config": {
"api_version": "constraints.gatekeeper.sh/v1alpha1",
"kind": "GCPEnforceLabelConstraintV1",
"metadata": {
"annotations": {
"description": "Checks that labels are set for all resources (or a subset of resources) and that they match a certain regular expression pattern.",
"validation.gcp.forsetisecurity.org/originalName": "require_labels",
@Sedward
Sedward / sse.go
Created January 13, 2016 05:31 — forked from ismasan/sse.go
Example SSE server in Golang
package main
import (
"fmt"
"log"
"net/http"
"time"
)
// Example SSE server in Golang.

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?

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Sedward
Sedward / unused_indexes.sql
Created October 22, 2013 17:10
Find unused indexes in Postgresql
select s.schemaname as sch, s.relname as rel, s.indexrelname as idx, s.idx_scan as scans, pg_size_pretty(pg_relation_size(s.relid)) as ts, pg_size_pretty(pg_relation_size(s.indexrelid)) as "is" from pg_stat_user_indexes s join pg_index i on i.indexrelid=s.indexrelid left join pg_constraint c on i.indrelid=c.conrelid and array_to_string(i.indkey, '') = array_to_string(c.conkey, '') where i.indisunique is false and pg_relation_size(s.relid) > 1000000 and s.idx_scan < 100000 and c.confrelid is null order by s.idx_scan asc, pg_relation_size(s.relid) desc;
@Sedward
Sedward / tail.sh
Created September 20, 2013 23:18
multi tail
ssh -n user@hostname1 'tail -f /mylogs/log' &
ssh -n user@hostname2 'tail -f /mylogs/log' &
@Sedward
Sedward / gist:5817428
Created June 19, 2013 19:47
ruby memory
ruby -e 'system "pmap #{Process.pid} | tail -1"'
@Sedward
Sedward / server.clj
Created February 26, 2013 19:50 — forked from jhulten/server.clj
(ns statsd-clj.server
(:use [aleph.udp]
[gloss core io]
[lamina core api])
(:require [statsd-clj.config :as config]
[statsd-clj.metrics :as metrics]
[clojure.tools.logging :as log]))
(def socket-server (agent nil))