Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bobbytables's full-sized avatar
🔥
Putting out fires

Robert Ross bobbytables

🔥
Putting out fires
View GitHub Profile
config = Rails.application.config.x.gcloud
pubsub = Google::Cloud::Pubsub.new project_id: config["project_id"], credentials: config["pubsub"]["keyfile"]
topic = pubsub.topic "incident-events"
sub = topic.subscription "hello-world"
subscriber = sub.listen do |received_message|
puts "sub 1"
puts received_message.message.data
received_message.acknowledge!
apiVersion: config.istio.io/v1alpha2
kind: prometheus
metadata:
clusterName: ""
creationTimestamp: 2018-09-21T16:32:54Z
name: handler
namespace: istio-system
resourceVersion: "98310577"
selfLink: /apis/config.istio.io/v1alpha2/namespaces/istio-system/prometheuses/handler
uid: fd9e637a-bdbb-11e8-bdcf-0ec5bee14916
@bobbytables
bobbytables / main.go
Created April 26, 2018 20:24
A dumb little HTTP server to print headers easily using a tabwriter.
package main
import (
"fmt"
"log"
"net/http"
"os"
"strings"
"text/tabwriter"
)
@bobbytables
bobbytables / configmap.yaml
Created January 12, 2018 14:08
Example of ConfigMaps and PodSpecs
apiVersion: v1
data:
endpoint_deadline: 5s
listen_addr: "0.0.0.0"
listen_port: "50051"
metadata:
name: heimdall
namespace: default
@bobbytables
bobbytables / brace.yml
Created October 6, 2017 00:18
A sample file of what a brace rule set could look like
version: 1
environment:
- name: LISTEN_ADDRESS
value: "localhost:8080"
usage: "This is the address that the application listens on"
- name: HEALTH_ADDRESS
value: "localhost:8080/healthz"
usage: "This is the endpoint for health checks performed by kubernetes"
- name: DATABASE_URL
value: "postgres://postgres:5432"
@bobbytables
bobbytables / build.sh
Created February 18, 2017 15:49
Protocol Buffer build script for multiple folders
#!/usr/bin/env bash
# This script is meant to build and compile every protocolbuffer for each
# service declared in this repository (as defined by sub-directories).
# It compiles using docker containers based on Namely's protoc image
# seen here: https://github.com/namely/docker-protoc
set -e
REPOPATH=${REPOPATH-/opt/protolangs}
CURRENT_BRANCH=${CIRCLE_BRANCH-"branch-not-available"}
syntax = "proto3";
message Error {
string message = 1;
int32 error_code = 20;
}
message Application {
string id = 1;
string type = 2;
@bobbytables
bobbytables / json_generation_benches.rb
Last active August 29, 2015 14:07
Kartograph for JSON generation is fast.
require 'benchmark/ips'
require 'active_support/core_ext'
require 'jbuilder'
require 'kartograph'
require 'active_model_serializers'
require 'pry'
User = Struct.new(:id, :name, :email) do
def read_attribute_for_serialization(attribute)
send(attribute)
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: MacBookPro11,3
Processor Name: Intel Core i7
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 6 MB
@bobbytables
bobbytables / rdio_volume_hack.js
Created May 21, 2014 17:02
This makes the Rdio volume slider larger so the ticks of volume control change the setting slightly less.
$('div.volume_wrapper').css({width: '150px'}).find('.Volume').css({width: '150px'})