Skip to content

Instantly share code, notes, and snippets.

View rgarcia's full-sized avatar

Rafael rgarcia

View GitHub Profile
@rgarcia
rgarcia / diff.txt
Created March 26, 2016 23:06
ldclient-node eventsource patch
*** 171,176 ****
--- 171,177 ----
req.on('error', onConnectionClosed);
req.setNoDelay(true);
+ req.setSocketKeepAlive(true);
req.end();
}
@rgarcia
rgarcia / b.go
Created March 14, 2016 21:21
mocking a vendored dependency
// $GOPATH/src/a/vendor/b/b.go
package b
import "log"
type Type int
type Interface interface {
InterfaceMethod(Type)
}
@rgarcia
rgarcia / openvpn.json
Last active February 5, 2016 01:29
OpenVPN
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Launch OpenVPN Server in an existing Virtual Private Cloud (VPC).",
"Parameters" : {
"InstanceType" : {
"Description" : "Instance type for OpenVPN Server",
"Type" : "String",
"Default" : "t2.micro",
"AllowedValues" : [ "t2.micro","t2.small","t2.medium","m3.medium","m3.large","m3.xlarge","m3.2xlarge"],
"ConstraintDescription" : "must be a valid EC2 instance type."
@rgarcia
rgarcia / vpc.json
Created February 5, 2016 01:10
VPC
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "VPC with two public subnets and two private subnets in different AZs, and a NAT to enable instances in private subnets to access the internet",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the bastion host",
"Type" : "AWS::EC2::KeyPair::KeyName"
}
.PHONY: build run local-dev
build: $(wildcard ./**/*)
docker build -t myimage .
run:
docker run myimage
local-dev:
./local-dev.sh
@rgarcia
rgarcia / b.go
Created August 4, 2015 22:09
PkgPath bug?
// $GOPATH/src/a/vendor/b/b.go
package b
type B struct {
}
@rgarcia
rgarcia / main.go
Created May 13, 2015 04:00
program that runs a mongo replset and periodically reconfigures it
package main
import (
"fmt"
"io"
"log"
"os"
"os/signal"
"syscall"
"time"
@rgarcia
rgarcia / main.go
Last active August 29, 2015 14:21
get a type definition from the result of an mgo query
package main
import (
"fmt"
"log"
"os"
"os/signal"
"syscall"
"github.com/facebookgo/mgotest"
@rgarcia
rgarcia / foo.go
Last active August 29, 2015 14:10
testing read-only interfaces
package foo
type Foo struct {
}
type DB interface {
Find(string) (Foo, error)
}
@rgarcia
rgarcia / supervisor.conf
Last active April 4, 2018 07:52
supervisord docker run
[inet_http_server]
port=0.0.0.0:9001
[supervisord]
logfile=out.log
loglevel=info
nodaemon=true
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface