Skip to content

Instantly share code, notes, and snippets.

View matthewgrossman's full-sized avatar
🙈

Matthew Grossman matthewgrossman

🙈
View GitHub Profile
@matthewgrossman
matthewgrossman / goodgifs.md
Last active September 5, 2023 17:50
goodgifs
After leaving $LASTJOB, I realized the slack emojis I absolutely need
@matthewgrossman
matthewgrossman / overrides.proto
Created December 15, 2021 06:18
override protobuf
syntax = "proto3";
/* container for override metadata */
message Overrides {
// maps cluster_name -> ip_port
map<string, string> routing_overrides = 1;
}
@matthewgrossman
matthewgrossman / encode.py
Last active December 15, 2021 06:22
baggage encoding
from base64 import standard_b64decode, standard_b64encode
from flask import Flask, request
from lightstep.lightstep_carrier_pb2 import BinaryCarrier
import overrides_pb2
def header_from_overrides(overrides: overrides_pb2.Overrides) -> bytes:
"""
@matthewgrossman
matthewgrossman / header_from_overrides.py
Created December 8, 2021 04:19
header_from_overrides.py
overrides_proto = OverridesProto({
"users": "10.0.0.42:80",
"fraud": "10.0.1.23:80",
})
def header_from_overrides(overrides: OverridesProto) -> str:
"""
Attach the `overrides` to the trace's baggage and return the new `x-ot-span-context` header
"""
b64_overrides = b64encode(overrides.SerializeToString())
@matthewgrossman
matthewgrossman / 0filter__interface.cc
Last active November 16, 2021 23:27
staging overrides blog post
class OverrideRoutingFilter: public PassThroughDecoderFilter {
public:
...
FilterHeadersStatus decodeHeaders(RequestHeaderMap & headers, bool) override;
private:
...
StreamDecoderFilterCallbacks* decoder_callbacks_;
};

Keybase proof

I hereby claim:

  • I am matthewgrossman on github.
  • I am matthewgrossman (https://keybase.io/matthewgrossman) on keybase.
  • I have a public key ASDoLhAUCUpg2PWOTU4M3o-dgCGlB1u9vgngyVjOGWQELQo

To claim this, I am signing this object:

@matthewgrossman
matthewgrossman / get_repos.py
Last active January 1, 2018 23:38
Given a Github organization and a scoped access token, this script will pull down all repositories
import csv
import json
from typing import Any, Dict, Optional, Tuple
import requests
Repos = Dict[str, Any]
def get_repos(org: str, access_token: str) -> Repos:

Keybase proof

I hereby claim:

  • I am matthewgrossman on github.
  • I am matthewgrossman (https://keybase.io/matthewgrossman) on keybase.
  • I have a public key whose fingerprint is B15A 1651 E4AF 8344 B7BA 5D8B 883B DED1 F837 B121

To claim this, I am signing this object:

@matthewgrossman
matthewgrossman / curry.js
Created December 25, 2015 08:35
curry interview question
function add(x, y) {
return x+y;
}
function add5(a,b,c,d,e) {
return a+b+c+d+e;
}
function curry(func) {
var len = func.length;