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 / dbhist.sh
Created July 16, 2020 04:27 — forked from outcoldman/dbhist.sh
DBHist: bash history in sqlite
# The MIT License
# SPDX short identifier: MIT
# Further resources on the MIT License
# Copyright 2017 Denis Gladkikh (https://www.outcoldman.com/en/archive/2017/07/19/dbhist/)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@ebenoist
ebenoist / Dockerfile
Created May 27, 2020 15:08
Ubuntu + Ruby <3
FROM ubuntu:18.04
# skip installing gem documentation
RUN set -eux; \
mkdir -p /usr/local/etc; \
{ \
echo 'install: --no-document'; \
echo 'update: --no-document'; \
} >> /usr/local/etc/gemrc
@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) => {
@ebenoist
ebenoist / slack.go
Created August 16, 2018 17:44
Chat Server!
package main
import (
"bufio"
"fmt"
"log"
"net"
)
type Room struct {
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
#!/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"
@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 {
@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 / 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 / ch9.go
Last active June 21, 2016 01:22
ch9.go
package main
import (
"fmt"
"os"
"strconv"
"time"
)
func main() {