Skip to content

Instantly share code, notes, and snippets.

View ptone's full-sized avatar

Preston Holmes ptone

View GitHub Profile
@ptone
ptone / idle.sh
Created July 8, 2019 16:10 — forked from ikbear/idle.sh
Docker image entrypoint idle script
#!/bin/bash
echo "This is a idle script (infinite loop) to keep container running."
echo "Please replace this script."
cleanup ()
{
kill -s SIGTERM $!
exit 0
}
@ptone
ptone / exmaple.go
Last active June 17, 2019 23:43 — forked from wlhee/exmaple.go
Generate Open ID Token Connect with Google Service Account Key
package main
import (
"context"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
# Create pubsub topics for cron regular tasks
gcloud pubsub topics create cron-minute
gcloud pubsub topics create cron-hour
gcloud pubsub topics create cron-day
# Create minute, hour, daily heartbeat events
gcloud alpha scheduler jobs create pubsub minute-task --topic cron-minute --schedule="* * * * *" --message-body="OK"
gcloud alpha scheduler jobs create pubsub hour-task --topic cron-hour --schedule="0 * * * *" --message-body="OK"
gcloud alpha scheduler jobs create pubsub day-task --topic cron-day --schedule="0 2 * * *" --message-body="OK"
@ptone
ptone / aead.py
Created December 27, 2018 19:13
chachapoly interop sanity check
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305
data = b"secret"
data = bytes([0x01,0x01,0x01,0x01,0x01,0x01])
aad = b"1111111111111111"
aad = bytes([0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01])
nonce = b"111111111111" # os.urandom(12)
nonce = bytes([0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01])
test_key = ChaCha20Poly1305.generate_key()
key = bytes([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
@ptone
ptone / hue-lutron.go
Created January 6, 2017 17:49
Mirroring Hue lights by watching Lutron integration local-hub
package main
import (
"log"
"github.com/heatxsink/go-hue/groups"
"github.com/heatxsink/go-hue/lights"
"github.com/heatxsink/go-hue/portal"
lutronlib "github.com/ptone/go-lutron"
)
@ptone
ptone / opentracing-zipkin.md
Created December 23, 2016 01:41 — forked from codefromthecrypt/opentracing-zipkin.md
My ramble on OpenTracing (with a side of Zipkin)

I've had many people ask me questions about OpenTracing, often in relation to OpenZipkin. I've seen assertions about how it is vendor neutral and is the lock-in cure. This post is not a sanctioned, polished or otherwise muted view, rather what I personally think about what it is and is not, and what it helps and does not help with. Scroll to the very end if this is too long. Feel free to add a comment if I made any factual mistakes or you just want to add a comment.

So, what is OpenTracing?

OpenTracing is documentation and library interfaces for distributed tracing instrumentation. To be "OpenTracing" requires bundling its interfaces in your work, so that others can use it to time distributed operations with the same library.

So, who is it for?

OpenTracing interfaces are targeted to authors of instrumentation libraries, and those who want to collaborate with traces created by them. Ex something started a trace somewhere and I add a notable event to that trace. Structure logging was recently added to O

@ptone
ptone / ctab
Created September 26, 2014 19:04
A quick CLI tool to work with too many tabs
#!/bin/bash
export BROWSER='Google Chrome'
stab "$@"

Keybase proof

I hereby claim:

  • I am ptone on github.
  • I am ptone (https://keybase.io/ptone) on keybase.
  • I have a public key whose fingerprint is B518 8473 483A CADF 7504 A871 41FE AC7C 7B5A 8F8E

To claim this, I am signing this object:

@ptone
ptone / gist:9119047
Created February 20, 2014 17:30 — forked from apsoto/gist:2869888
require 'rubygems'
require 'activesupport'
require 'aws'
require 'graphviz'
ec2 = Aws::Ec2.new(ENV["AMAZON_ACCESS_KEY_ID"], ENV["AMAZON_SECRET_ACCESS_KEY"])
g = ec2.describe_security_groups
gv = GraphViz::new( "structs", "type" => "graph" )
@ptone
ptone / vpcgraph.py
Created February 20, 2014 17:30 — forked from j3tm0t0/vpcgraph.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import boto.ec2
import boto.vpc
def dprint (body):
# print >> sys.stderr, body
return