$ for i in seq 1 3; do go test -bench=. -benchtime=5s; echo; done
goos: linux
goarch: amd64
pkg: github.com/Scout24/go-observability/.local
BenchmarkCallWithoutSlice-4 100000000 76.8 ns/op
BenchmarkCallWithSlice-4 100000000 77.1 ns/op
BenchmarkCallWithSliceCopy-4 100000000 76.4 ns/op
PASS
ok github.com/Scout24/go-observability/.local 23.277s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns a `200 OK` response with the body `Hello World` to any incoming request | |
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func helloWorld(writer http.ResponseWriter, request *http.Request) { | |
writer.Write([]byte("Hello World")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tdigest_benchmark | |
import ( | |
"fmt" | |
"math/rand" | |
"testing" | |
"time" | |
ajwerner "github.com/ajwerner/tdigest" | |
caio "github.com/caio/go-tdigest" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package foo | |
import ( | |
"C" | |
"strings" | |
) | |
var testString = strings.Repeat("x", 1024) | |
func NativeStrings(amount int) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package play | |
import "testing" | |
type ( | |
aDataType struct { | |
A string | |
B int | |
C []byte | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# != 1 ]; then | |
echo "Usage: $0 <golang-package>" | |
echo " for example:" | |
echo " $0 github.com/gobuffalo/packr/packr" | |
exit 1 | |
fi | |
docker run --rm \ |
What can you do with ldapsearch
outputs? Not much. With JSON, though ..
# from LDAP search tool ...
ldapsearch -h 127.0.0.1 -p 10389 \
-D "cn=me,ou=Acme,dc=local" -w 'mypa$$w00t" \
-b "ou=machines,ou=Acme,dc=local" \
-s sub "(objectclass=machine)"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#--------------- | |
# | |
# Installation: | |
# $ curl -Lo ~/.godev http://tiny.cc/godev | |
# $ echo "source ~/.godev" >> ~/.$(basename $SHELL)rc | |
# | |
# Usage: | |
# # Tries to determine go workspace directory, then | |
# # exports it into GOPATH environment variable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(ticks = 1); | |
// Your graceful shutdown handler | |
function exitGracefully($signal) { | |
// do stuff, then end with exit code 0, so that the deploy can continue | |
// or exit with non-zero code, so that the deploy aborts | |
echo "Shutting down gracefully\n"; | |
exit(0); |
Assumes that path/to/subdir
is directory containing composer.json
and composer.lock
files.
NewerOlder