Skip to content

Instantly share code, notes, and snippets.

@asim
asim / sysctl.conf
Created September 14, 2013 11:40 — forked from kgriffs/sysctl.conf
# Configuration file for runtime kernel parameters.
# See sysctl.conf(5) for more information.
# Protection from SYN flood attack.
net.ipv4.tcp_syncookies = 1
# See evil packets in your logs.
#net.ipv4.conf.all.log_martians = 1
# Disable packet forwarding.
{
"cluster_name" : "logging-search",
"nodes" : {
"gpObg-oHQ4e_B8XeprCi1w" : {
"timestamp" : 1408566038068,
"name" : "Vibraxas",
"transport_address" : "inet[/10.x.x.x:9300]",
"hostname" : "foo",
"indices" : {
"docs" : {
package main
import (
"fmt"
"time"
"github.com/myodc/go-micro/registry"
)
func do() {
package main
import (
"bytes"
"flag"
"fmt"
"net/http"
"net/url"
"os"
"runtime"
@asim
asim / environment.go
Created September 28, 2015 09:47
HTTP server that displays environment information
package main
import (
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"net/http"
"os"
"strings"
"text/template"
)
@asim
asim / gist:4463c5c0343b59347c81
Created November 8, 2015 12:15
go-micro versions
$ go run micro/main.go get service go.micro.srv.greeter
service go.micro.srv.greeter
version 1.0.0
Id Address Port Metadata
go.micro.srv.greeter-4b0fe9f5-8612-11e5-9965-68a86d0d36b6 192.168.1.64 55576
version 1.0.2
@asim
asim / grpc.go
Created November 10, 2015 14:29
GRPC example
package main
import (
"fmt"
h "github.com/grpc/grpc-common/go/helloworld"
"github.com/myodc/go-micro/client"
"golang.org/x/net/context"
)
@asim
asim / codec.go
Created November 27, 2015 23:38
Go-micro Codec Interface
const (
Error MessageType = iota
Request
Response
Publication
)
type Codec interface {
Encoder
Decoder
@asim
asim / kv.go
Created December 1, 2015 12:01
package kv
import (
"errors"
consul "github.com/hashicorp/consul/api"
)
type consulKV struct {
Client *consul.Client
package main
import (
"fmt"
"github.com/micro/go-micro/registry"
)
func main() {
w, err := registry.Watch()
if err != nil {