Skip to content

Instantly share code, notes, and snippets.

@christopher-wong
christopher-wong / main.go
Last active August 8, 2022 00:35
The Sleeping-Doctor Problem
package main
import (
"context"
"log"
"sync"
"time"
)
const (
@christopher-wong
christopher-wong / main.go
Created August 13, 2021 20:13
Dynamo stream processor that handles polymophmic type conversion to JSON
package main
import (
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
)
@christopher-wong
christopher-wong / main.go
Created January 6, 2021 16:34
Golang HTTP Server Context Propagation Issue
package main
import (
"context"
"encoding/json"
"log"
"math/rand"
"net/http"
"time"
syntax = "proto3";
package proto;
option go_package = ".;proto";
service Badger {
rpc SendPush(SendPushReq) returns (PushResp) {}
rpc SendRawPush(SendRawPushReq) returns (PushResp) {}
rpc Register(RegisterReq) returns (RegisterResp) {}
func run(args []string, stdout io.Writer) error {
envflag.Parse()
zapper, _ := zap.NewProduction()
logger := zapper.Sugar()
// load configuration from config file and environment
cfg, err := config.Load()
if err != nil {
logger.Errorw(configInitErr,

Keybase proof

I hereby claim:

  • I am christopher-wong on github.
  • I am christopherwong (https://keybase.io/christopherwong) on keybase.
  • I have a public key whose fingerprint is 19F1 6704 BFEA 14C6 C8D0 2237 C71F 3201 1316 5330

To claim this, I am signing this object:

@christopher-wong
christopher-wong / facebook_phone_1_2018.py
Created July 16, 2018 23:43
Facebook New Grade SWE Interview
# Welcome to Facebook!
# This is just a simple shared plaintext pad, with no execution capabilities.
# When you know what language you'd like to use for your interview,
# simply choose it from the dropdown in the top bar.
# Enjoy your interview!
## Move all nonzero integers to left of an array and return the number of nonzero integers