Skip to content

Instantly share code, notes, and snippets.

View jasonhancock's full-sized avatar
meh

Jason Hancock jasonhancock

meh
View GitHub Profile
@jasonhancock
jasonhancock / README.md
Last active December 14, 2017 14:45
jenkins to statsd

A cheap way to get build events from jenkins into graphite via statsd:

/usr/local/bin/buildstats

#!/bin/bash
. /etc/default/buildstats
echo "$BUILD_PREFIX.$JOB_NAME:1|c" | nc -w 1 -u $STATSD_SERVER $STATSD_PORT

/etc/default/buildstats:

@jasonhancock
jasonhancock / main.go
Created August 30, 2017 20:44
simple udp server to debug statsd stuff
package main
import (
"fmt"
"log"
"net"
)
func handleUDPConnection(conn *net.UDPConn) {
@jasonhancock
jasonhancock / harvest_one_item.md
Created April 30, 2018 23:12
Harvesting a single item from s3 via the GrayMeta Platform API

How to initiate a harvest of a single asset in s3 that has not been previously indexed into the GrayMeta Platform

NOTE: my endpoint is http://localhost:7000. Your endpoint will be different.

Step 1:

You must know the name of the s3 bucket and the s3 key (the path within the bucket) to the asset.

For our example today, I want to harvest the key 5aba86635fc9cbec3a81839abc0fc2a9.jpg inside the hancocktest bucket in s3.

@jasonhancock
jasonhancock / main.go
Created November 29, 2018 19:28
bcrypt time cost at various difficulty factors
package main
import (
"fmt"
"log"
"time"
"golang.org/x/crypto/bcrypt"
)
@jasonhancock
jasonhancock / main.go
Created October 20, 2022 16:27
Go YAML Unmarshal list of interfaces
package main
import (
"errors"
"fmt"
"log"
"math"
"gopkg.in/yaml.v3"
)
@jasonhancock
jasonhancock / README.md
Created April 22, 2025 20:38
Golang graceful reload of SSL Certificate

Reloading an SSL certificate on the fly with Golang

Generate two self-signed certificates:

openssl genrsa -out server1.key 2048
openssl req -new -x509 -sha256 -key server1.key -out server1.pem -days 3650
openssl genrsa -out server2.key 2048
openssl req -new -x509 -sha256 -key server2.key -out server2.pem -days 3650