Skip to content

Instantly share code, notes, and snippets.

View dlsniper's full-sized avatar

Florin Pățan dlsniper

View GitHub Profile
@dlsniper
dlsniper / Dockerfile
Last active June 18, 2017 12:11
Dockerfile to build the webinar example
# build stage
FROM golang:1.8.3 AS build-env
ADD . /go/src/github.com/dlsniper/webinar
RUN go build -o /webinar github.com/dlsniper/webinar
# final stage
FROM ubuntu:16.04
WORKDIR /
COPY --from=build-env /webinar /
@dlsniper
dlsniper / webinar.go
Created June 18, 2017 11:08
webinar code
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
)
@dlsniper
dlsniper / loaderror.txt
Created March 1, 2017 19:25
Slack load error
2017/3/1 19:23:29.162 rtm.start failed; retry_after = NaN
rollup-core_required_ts.js:1 2017/3/1 19:23:29.162 Tried to finalize incremental boot, but rtm.start failed. Will recover when we reconnect.
_console @ rollup-core_required_ts.js:1
error @ rollup-core_required_ts.js:1
error @ rollup-core_required_ts.js:1
(anonymous) @ rollup-core_required_ts.js:1
tryCatcher @ rollup-core_required_libs.js:26
Promise._settlePromiseFromHandler @ rollup-core_required_libs.js:25
Promise._settlePromise @ rollup-core_required_libs.js:25
Promise._settlePromise0 @ rollup-core_required_libs.js:25
@dlsniper
dlsniper / bench
Last active February 8, 2017 23:10
Go 1.8RC3 BashOnWindows vs Pure Windows
Bash Windows
benchmark old ns/op new ns/op delta
BenchmarkBinaryTree17-8 2740384400 3162642000 +15.41%
BenchmarkFannkuch11-8 3323651700 3213270000 -3.32%
BenchmarkFmtFprintfEmpty-8 58.7 53.1 -9.54%
BenchmarkFmtFprintfString-8 174 129 -25.86%
BenchmarkFmtFprintfInt-8 160 128 -20.00%
BenchmarkFmtFprintfIntInt-8 175 188 +7.43%
@dlsniper
dlsniper / keybase.md
Last active October 9, 2016 08:55
keybase.md

Keybase proof

I hereby claim:

  • I am dlsniper on github.
  • I am dlsniper (https://keybase.io/dlsniper) on keybase.
  • I have a public key whose fingerprint is E59D 94AB 2C05 69B3 C63A 56B5 0AA5 CCB6 8EE3 4BE5

To claim this, I am signing this object:

@dlsniper
dlsniper / explicit.go
Created September 18, 2016 20:58
Dependency injection in Go by explicitly passing the dependency
package main
import "log"
type printerFunc func(message string, args ...interface{})
func hello(p printerFunc) {
p("hello %s", "world")
}
@dlsniper
dlsniper / wrapper.go
Created September 18, 2016 20:45
Dependency injection in Go via wrapping the function
package main
import "log"
type printerFunc func(message string, args ...interface{})
func helloWrapper(p printerFunc) func(string, ...interface{}) {
return func(message string, arguments ...interface{}) {
p(message, arguments...)
}
@dlsniper
dlsniper / typebound.go
Created September 18, 2016 20:44
Dependency injection in Go via explicit type
package main
import "log"
type printerFunc func(message string, args ...interface{})
type demo struct {
printer printerFunc
}
@dlsniper
dlsniper / nats
Created June 5, 2016 10:57
How to halve the performance of NATS
benchmark old ns/op new ns/op delta
Benchmark____PubNo_Payload-8 88.4 164 +85.52%
Benchmark____Pub8b_Payload-8 89.5 163 +82.12%
Benchmark___Pub32b_Payload-8 103 202 +96.12%
Benchmark__Pub256B_Payload-8 140 262 +87.14%
Benchmark____Pub1K_Payload-8 298 552 +85.23%
Benchmark____Pub4K_Payload-8 1165 1362 +16.91%
Benchmark____Pub8K_Payload-8 2889 3618 +25.23%
Benchmark___________PubSub-8 243 258 +6.17%
Benchmark___PubSubTwoConns-8 254 250 -1.57%
@dlsniper
dlsniper / get-all.bash
Created May 2, 2016 12:22
get all the dependencies from Godeps
#!/usr/bin/env bash
go get -v -u -t `grep -rin "importpath" Godeps/Godeps.json | cut -d' ' -f4 | tail -n +2 | cut -d'"' -f4 | sed -e 's/$/\/.../' | tr '\n' ' '`