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
@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"}
alias ta="tmux attach-session -t"
alias tn="tmux new-session -s"
alias tl="tmux list-sessions"
alias tk="tmux kill-session -t"
export EDITOR=subl
source ~/.git-completion.sh
# Aliases!!
alias ls="ls -lsa"
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 / cli_aliases.md
Created February 26, 2013 08:06
Aliases and Profiles

So an alias in your terminal is a shortcut to a command, or command with arguments.

For example, Brendan has an alias for ll (double L) that does the ls -l command. Which as we showed will display a list of files vertically in your terminal instead the hard-to-read horizontal way.

These are extremely handy for when you see yourself doing the same command over and over, just make an alias!

To do so, we're going to add it to your profile file. This file is run everytime you start a new session in your terminal (so starting terminal, or a new tab).

Open up terminal. Type in:

require 'benchmark'
task :db_bench => :environment do
Benchmark.bm do |b|
b.report { 1.upto(10000) { User.first } }
b.report { 1.upto(10000) { User.select([:email, :default_edition_id]).first } }
b.report { 1.upto(10000) { User.first.created_at } }
b.report { 1.upto(10000) { User.select([:created_at, :default_edition_id]).first.created_at } }
syntax = "proto3";
message Error {
string message = 1;
int32 error_code = 20;
}
message Application {
string id = 1;
string type = 2;