Skip to content

Instantly share code, notes, and snippets.

@albttx
albttx / hasmany.go
Created December 13, 2017 15:49
Golang GORM has_many exemple
package main
import (
"fmt"
"log"
"github.com/Sirupsen/logrus"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
)
@philipjkim
philipjkim / elastic_aggregator.go
Last active June 16, 2021 18:02
Go Elasticsearch aggregation example
package main
import (
"fmt"
"time"
"encoding/json"
elastic "gopkg.in/olivere/elastic.v3"
)
### autoscale.tf
data "template_file" "userdata" {
template = "${file("templates/userdata.tpl")}"
vars {
region = "${var.region}"
file_system_id = "${aws_efs_file_system.prod-efs.id}"
}
}
resource "aws_launch_configuration" "mig5-prod-lc" {
@wallyqs
wallyqs / Docker Compose + NATS example
Last active February 18, 2024 22:27
NATS Docker blog post/HTTP Server
FROM golang:1.6.2
COPY . /go
RUN go get github.com/nats-io/nats
RUN go build api-server.go
EXPOSE 8080
ENTRYPOINT ["/go/api-server"]
@markwallsgrove
markwallsgrove / go-update.go
Created February 18, 2016 20:21
go-update tutorial, fast start
package main
// https://godoc.org/github.com/inconshreveable/go-update
// This gist documents go-install using a SHA-256 checksum,
// elliptic curve (prime 256) encrypted signature & bsdiff
// formatted patch.
// These steps took me over a hour to figure. go-install currently
// doesn't include a tutorial or quick start guide, so I created this
@poindextrose
poindextrose / glcoud-signed-url.go
Last active January 22, 2024 22:59
Example on how to create a signed URL on Google Cloud Storage with Go
package main
import (
"fmt"
"time"
"google.golang.org/cloud/storage"
)
const (
@hhcordero
hhcordero / 1_Dockerised_JMeter.md
Last active March 30, 2022 13:44
Dockerized JMeter - A Distributed Load Testing Workflow
@nl5887
nl5887 / Makefile
Created September 11, 2015 16:36
grapviz tcpdump
LAYOUT=circo
SOURCES = $(wildcard *.dot)
TARGETS = $(SOURCES:.dot=.svg)
%.svg:%.dot
dot -Tsvg -K${LAYOUT} "$^" -o "$@"
all: $(TARGETS)
clean:
@busbey
busbey / host_offset.txt
Last active August 3, 2021 19:01
Helper for running YCSB "Core Workloads" on multiple hosts.
client-1.example.com:0
client-2.example.com:429496729
client-3.example.com:858993458
client-4.example.com:1288490187
client-5.example.com:1717986916
@iamralch
iamralch / ssh_client.go
Last active April 16, 2023 03:09
SSH client in GO
package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"strings"