Skip to content

Instantly share code, notes, and snippets.


Sean Hagen seanhagen

Block or report user

Report or block seanhagen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
seanhagen / base.go
Created Aug 27, 2019
Interface/API Design Question
View base.go
package email
import (
// Version 1
// Sender is an interface to hide the fact we're using a 3rd party library
type Sender interface {
seanhagen / go-config.el
Created Jun 24, 2019
Emacs LSP & yasnippet config
View go-config.el
;;; go-config.el --- Summary
;;; Commentary:
;;; Code:
(setenv "GOPATH" "/home/sean/Code/Go")
(use-package go-mode
:ensure t
:defer t
:mode "\\.go\\'"
seanhagen / grpc-middleware.go
Created Apr 4, 2019
Honeycomb Go GRPC Middleware
View grpc-middleware.go
// HoneycombUnary returns an interceptor that adds Honeycomb metrics to any incoming unary requests.
func HoneycombUnary() grpc.UnaryServerInterceptor {
return func(ctx context.Context, r interface{}, i *grpc.UnaryServerInfo, h grpc.UnaryHandler) (interface{}, error) {
ctx, t, s := setupTrace(ctx, r, i.FullMethod, "unary")
defer t.Send()
o, err := h(ctx, r)
result := "success"
if err != nil {


There is a Vancovuer Developers Slack channel which is a great forum to ask for help on projects, checkout freelance opportunities, or get together and code with others!

Vancouver Developers

And if you join the channel #lhl-coffee-code you can come hang out with us on Wednesdays and work on coding projects!

If you are interested in ethics in tech, we also have an ethics in tech meetup group - we'll probably have a group for this in Vancouver Developers at some point but if you're interested, feel free to drop me an email ( and I can put you in touch.

seanhagen / example.go
Created Feb 21, 2019
Example non-working pipeline
View example.go
package main
import (
ps ""
seanhagen / events.go
Created Feb 11, 2019
Cloud Dataflow -- trying to get GCS writes working
View events.go
package main
import (
ps ""
View anonymous-gist.go
// p := profile.Start(profile.CPUProfile, profile.ProfilePath("/tmp/prof"), profile.NoShutdownHook)
p := profile.Start(profile.MemProfile, profile.ProfilePath("/tmp/prof"), profile.NoShutdownHook)
time.AfterFunc(time.Minute, func() {
fmt.Printf("1 minute until profiling stopped\n")
time.AfterFunc(time.Minute*2, func() {
fmt.Printf("stopping profiling\n")
seanhagen / anonymous-gist.go
Created Oct 24, 2018
Golang func to print memory usage
View anonymous-gist.go
func PrintMemUsage(id int, name string) {
var m runtime.MemStats
// For info on each, see:
"Call %v from %v -- Alloc = %v MiB\tTotalAlloc = %v MiB\tSys = %v MiB\tNumGC = %v\n",
seanhagen / example-service.go
Created Oct 20, 2018
Example implementation of server for reproduction
View example-service.go
// PingMe ...
func (s *Service) PingMe(ctx context.Context, in *api.PingMessage) (*api.PongMessage, error) {
header := metadata.Pairs("header-key", "val")
err := grpc.SendHeader(ctx, header)
return &api.PongMessage{Response: fmt.Sprintf("pongback: %v", in.Greeting)}, err
// StreamIn ...
func (s *Service) StreamIn(stream api.Ping_StreamInServer) error {
count := 0
seanhagen / k8s.yml
Last active Oct 20, 2017
K8S Config
View k8s.yml
apiVersion: v1
kind: Service
name: users
- port: 80
targetPort: 80
protocol: TCP
You can’t perform that action at this time.