Skip to content

Instantly share code, notes, and snippets.

View steevehook's full-sized avatar
📖
redefining education

Steve Hook steevehook

📖
redefining education
View GitHub Profile
func waitTillTableHasCount(conn sqlbuilder.Database, table string, n int) error {
timeout := time.After(5 * time.Second)
for {
select {
case <-timeout:
count, err := conn.Collection(table).Find().Count()
if err != nil {
return err
}
return fmt.Errorf(
@steevehook
steevehook / logger_middleware.go
Created April 3, 2019 08:15 — forked from blixt/logger_middleware.go
Logger middleware for Go HTTP servers which logs every request with response status code in the Apache format.
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"time"
)
@steevehook
steevehook / main.go
Created April 3, 2019 08:12 — forked from creack/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
ssh-agent $(ssh-add ~/.ssh/id_rsa)
@steevehook
steevehook / gist:3cf47ab0f664865c1977ac92f8c82a05
Created March 22, 2019 12:10 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
if [[ "$(docker images -q iam:${IMAGE_TAG} 2> /dev/null)" == "" ]]; then
docker image ls -q iam | xargs docker image rm -f
buildImage
fi
FROM node:alpine as builder
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
RUN npm run build
package main
import (
"encoding/json"
"fmt"
"bytes"
// "github.com/davecgh/go-spew/spew"
)
/*
export $(grep -v '^#' .env-dev | xargs)
git format-patch -1 <sha>