Skip to content

Instantly share code, notes, and snippets.

@yob
yob / graphql-test
Created April 10, 2020 15:04
buildkite graphql sample, via ruby
#!/usr/bin/env ruby
require 'json'
require 'net/http'
query = <<-EOS
{
organization(slug: "example-slug") {
members(first: 100, email: "james@example.com") {
edges {
@yob
yob / bk-agent-non-root-deployment.yaml
Created March 23, 2020 11:01
An approach to deploying the buildkite agent to GKE as non-root
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: build-robot
spec:
replicas: 1
template:
metadata:
labels:
app: build-robot
@yob
yob / buildkite-kube.yml
Last active May 4, 2021 13:34
one way to run buildkite on kube
apiVersion: apps/v1
kind: Deployment
metadata:
name: build-robot
spec:
replicas: 3
template:
metadata:
labels:
app: build-robot
@yob
yob / main.tf
Last active February 3, 2020 04:54
minimal fargate setup via terraform
provider "aws" {
region = "us-east-1"
version = "~> 2.45"
}
data "aws_region" "primary" {
}
data "aws_availability_zones" "primary" {
}
@yob
yob / commands.txt
Last active January 29, 2020 09:32
aws cli reference
# list accounts I have access to in our org
aws organizations list-accounts
# list roles in our account
aws iam list-roles
@yob
yob / json_text.rb
Created October 2, 2019 00:10
Extract characters from a PDF in a JSON blob
require 'pdf/reader'
require 'json'
require 'forwardable'
class JsonTextReceiver
extend Forwardable
SPACE = " "
attr_reader :state, :options, :characters
@yob
yob / ip-to-as
Last active February 10, 2023 09:41
#!/usr/bin/env ruby
# Small script that converts an IP address into its AS number. Also provides a
# helpful link to Geoff Huston's handy AS summary page
require 'ipaddr'
require 'resolv'
USAGE = "ip-to-as <ipv4/ipv6>"
@yob
yob / git-fetch-pr
Created February 25, 2019 11:20
fetch pull requests without adding a new remote
#!/bin/bash -e
##################################################
# git-fetch-pr
#
# A script to ease checking out github pull requests as a local branch, without
# the hassle of adding a new remote
##################################################
USAGE="USAGE: git-fetch-pr <pr-number> [remote]"
@yob
yob / docker.sh
Last active June 29, 2018 03:47
gcloud, kubectl an ddocker cheatsheat
# start a container with bash (or sh)
docker run -ti --entrypoint=bash image:tag
# list docker images on local machine
docker images
# view layers of an individual image
docker history image:tag [--no-trunc]
@yob
yob / notes.md
Last active October 22, 2017 11:40
concurrent requests in tc-analytics

Webrick

Conventional wisdon in the ruby community is that webrick in unsuitable for production, partly because it's single threaded.

For example, the heroku docs say:

By default WEBrick is single threaded, single process

And this