Skip to content

Instantly share code, notes, and snippets.

View joemiller's full-sized avatar

joe miller joemiller

View GitHub Profile
@joemiller
joemiller / renewer.go
Created June 16, 2021 15:57
demo of vault token renewer go routine from internal project
type VaultDriver struct {
vaultClient *vaultapi.Client
project string
}
func (d VaultDriver) TokenRenewer(ctx context.Context) error {
renewer, err := d.vaultClient.NewRenewer(&vaultapi.RenewerInput{
Secret: &vaultapi.Secret{
Auth: &vaultapi.SecretAuth{
ClientToken: d.vaultClient.Token(),
@joemiller
joemiller / foo.sh
Last active September 24, 2020 22:51
demo of bash vars global scope by default
#!/bin/bash
foo() {
op=$1
# local op=$1
echo "foo: op is $op"
}
main() {
op="main"
@joemiller
joemiller / installer.sh
Created May 22, 2020 21:50
install script for autotag, generated with godownloader
#!/bin/sh
set -e
# Code generated by godownloader on 2020-05-22T18:17:38Z. DO NOT EDIT.
#
usage() {
this=$1
cat <<EOF
$this: download go binaries for pantheon-systems/autotag
@joemiller
joemiller / poc.py
Last active May 7, 2020 16:44
POC getting cpu% from cgroups
#!/usr/bin/env python
# Usage:
# curl -sL https://gist.githubusercontent.com/joemiller/d89002a0d169cbb977e735df20e4ebd7/raw/poc.py | python | sort -rnk3 | head -n10
# or with a different INTERVAL:
# curl -sL https://gist.githubusercontent.com/joemiller/d89002a0d169cbb977e735df20e4ebd7/raw/poc.py | INTERVAL=60 python | sort -rnk3 | head -n10
import os
import time
def main():
@joemiller
joemiller / disable-gcp-accounts-daemon.sh
Last active April 10, 2020 20:35
disable and stop google-accounts-daemon
sed -i -e 's/accounts_daemon = true/accounts_daemon = false/' /etc/default/instance_configs.cfg.template
/bin/google_instance_setup
systemctl restart google-accounts-daemon
@joemiller
joemiller / stackdriver.json
Created February 11, 2020 15:33
stackdriver webhook payload v1.2 example
{
"incident": {
"incident_id": "0.lj2va6zdkemq",
"resource_id": "",
"resource_name": "foobar appserver",
"resource": {
"type": "gce_instance",
"labels": {
"instance_id": "8979287136362607111",
"zone": "us-central1-c"
@joemiller
joemiller / gceproject.go
Last active January 29, 2020 22:56
gceProject() golang function that implements multiple methods of determining the GCP project it is being run within
package main
import (
"context"
"errors"
"log"
"os"
"time"
"golang.org/x/oauth2/google"
@joemiller
joemiller / # gnupg - 2019-12-03_17-43-27.txt
Created December 4, 2019 01:47
gnupg on macOS 10.15.1 - Homebrew build logs
Homebrew build logs for gnupg on macOS 10.15.1
Build date: 2019-12-03 17:43:27
@joemiller
joemiller / pdns-recursor-cache-stats.rb
Last active October 11, 2019 19:11
quick 1-time script to parse pdns_recursor cache hit ratio and qps across a range of hosts
#!/usr/bin/env ruby
#
# Usage:
#
# $ ruby pdns-recursor-cache-stats.rb
#
# Might need to use sudo or run as root to access the pdns_recursor control socket
#
uptime = 0

test plan:

scenarios:

  1. vanilla
  2. with forked keyring lib

steps:

  • keychain
    • record stdout/stderr + exit code: