Skip to content

Instantly share code, notes, and snippets.

View sponomarev's full-sized avatar
🔴
Offline

Sergey Ponomarev sponomarev

🔴
Offline
View GitHub Profile
@sponomarev
sponomarev / context.go
Created October 17, 2018 20:10
Context with Signal
package cmd
import (
"context"
"os"
"os/signal"
"syscall"
)
// ContextWithSignal creates a context canceled when SIGINT or SIGTERM are notified
@sponomarev
sponomarev / README.md
Created October 29, 2018 15:23 — forked from joyrexus/README.md
Functional config in go

Quick demo of how to initialize your data structure with optional configuration parameters ... with sane defaults if left unspecified.

This functional config technique ...

  • lets you write APIs that can evolve without pain
  • provides meaningful configuration parameters
  • makes it easy to set default settings
  • makes it possible to set complex conditional values
GTr#7NyYLYvhqzgdoyLzrTrf
DELETE users
DELETE users_1_dedicated
# Create users index template
PUT _template/users
{
"index_patterns": ["users*"],
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
-include private.mk
foo :
echo "foo from Makefile"