Skip to content

Instantly share code, notes, and snippets.

View ebenoist's full-sized avatar
🐛
writing bugs

Erik Benoist ebenoist

🐛
writing bugs
View GitHub Profile
@ebenoist
ebenoist / bug.md
Created February 11, 2015 15:50
Bundler minitest bug

bundler env

[master][~/development/minitest-bundler-bug]❥ bundler env
Bundler 1.7.3
Ruby 2.1.2 (2014-05-08 patchlevel 95) [x86_64-darwin13.0]
Rubygems 2.2.2
GEM_HOME
@ebenoist
ebenoist / ch9.go
Last active June 21, 2016 01:22
ch9.go
package main
import (
"fmt"
"os"
"strconv"
"time"
)
func main() {
@ebenoist
ebenoist / topics.json
Created December 9, 2016 19:47
discover-topics
$ curl nsqlookupd1.local:4161/nodes?topics=clicks
{
"status_code": 200,
"status_txt": "OK",
"data": {
"producers": [
{
"remote_address": "127.0.0.1:17418",
"hostname": "box1",
"broadcast_address": "127.0.0.1",
@ebenoist
ebenoist / consumer.go
Last active March 1, 2020 16:23
nsq consumer
package main
import (
"errors"
"log"
"os"
"os/signal"
"syscall"
"github.com/nsqio/go-nsq"
@ebenoist
ebenoist / ProtoToStruct.java
Created February 5, 2017 21:43
Convert a Protobuf Description to a Spark SQL Schema
import com.google.protobuf.Descriptors;
import org.apache.spark.sql.types.DataType;
import org.apache.spark.sql.types.DataTypes;
import org.apache.spark.sql.types.StructField;
import org.apache.spark.sql.types.StructType;
import java.util.ArrayList;
import java.util.List;
public class ProtoToStruct {
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'protoc-gen-ruby2' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "pathname"
commit c8ef5485f93636fd3bdef74de19c96471452d66e
Author: Erik Benoist <ebenoist@gmail.com>
Date: Tue Oct 25 15:26:23 2016 -0500
Makes the compiler compatible with protoc version 3
diff --git a/Rakefile b/Rakefile
index 8df9895..bda79e4 100644
--- a/Rakefile
+++ b/Rakefile
@ebenoist
ebenoist / slack.go
Created August 16, 2018 17:44
Chat Server!
package main
import (
"bufio"
"fmt"
"log"
"net"
)
type Room struct {
@ebenoist
ebenoist / interceptor.ts
Created November 26, 2018 18:54
gRPC / Datadog / Open Tracing Interceptor
import * as tracer from 'dd-trace';
import * as opentracing from 'opentracing';
import { InterceptingCall } from 'grpc';
const TRACE_HEADER = 'x-datadog-trace-id';
const PARENT_HEADER = 'x-datadog-parent-id';
export default function gRPCInterceptor(options, nextCall) {
return new InterceptingCall(nextCall(options), {
start: (metadata, _listener, next) => {