Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"github.com/armon/mdns"
"os"
"time"
)
func main() {
# gosrc package to quickly cd into folder
function gosrc() {
cd $GOPATH/src
cd ./$1
}
export -f gosrc
package main
import (
"fmt"
"net"
"os"
"time"
)
const udpAddr = "127.0.0.1:10000"
package main
import (
"fmt"
"github.com/miekg/dns"
"net"
"time"
)
const domain = "consul."
package main
import (
"crypto/tls"
"fmt"
"github.com/inconshreveable/muxado"
"log"
"net"
)
#!/bin/sh
#
# This script installs and configures the Serf agent that runs on
# every node. As with the other scripts, this should probably be done with
# formal configuration management, but a shell script is simple as well.
#
# The SERF_ROLE environmental variable must be passed into this script
# in order to set the role of the machine. This should be either "lb" or
# "web".
#
def unicode_hammer(s):
if !isinstance(s, unicode):
return s
for enc in ("utf-8","utf-16", "utf-32", "latin-1"):
try:
return s.encode(enc, "replace")
except:
pass
return s
package main
import (
"encoding/binary"
"github.com/armon/gomdb"
)
func main() {
// Create the env
env, err := mdb.NewEnv()
package main
import (
"bytes"
"fmt"
"github.com/armon/gomdb"
"github.com/ugorji/go/codec"
"reflect"
"strings"
"sync/atomic"
Prefix: fb40ef7c-9d4d-b23d-f6fc-a14777c327e7
Inserting:
fb40ef7c-9d4d-b23d-f6fc-a14777c327e7/b1b6da9a-6edc-26ce-8b0e-685fa9806556
fb40ef7c-9d4d-b23d-f6fc-a14777c327e7/71b7ce26-4bb6-861f-5778-471d6e640018
fb40ef7c-9d4d-b23d-f6fc-a14777c327e7/9aba39af-8c5a-b7e4-3e8c-f3e6ff723cc2
fb40ef7c-9d4d-b23d-f6fc-a14777c327e7/e5f4f847-2283-9ec8-69b9-6d1209f69c4a
fb40ef7c-9d4d-b23d-f6fc-a14777c327e7/9898fd19-a66b-d945-f989-a4f5c0fefed1
fb40ef7c-9d4d-b23d-f6fc-a14777c327e7/e807189e-b547-d123-dbdd-b5a88e8bfbd6
fb40ef7c-9d4d-b23d-f6fc-a14777c327e7/f1b741bb-6ecf-3df0-7f96-c1f6b1b3b75c
fb40ef7c-9d4d-b23d-f6fc-a14777c327e7/ccb34cbb-59f0-31fb-bf5b-bd44163329c7