Skip to content

Instantly share code, notes, and snippets.

Steve Hook steevehook

Block or report user

Report or block steevehook

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View go_routine_check.go
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 Apr 3, 2019 — forked from blixt/logger_middleware.go
Logger middleware for Go HTTP servers which logs every request with response status code in the Apache format.
View logger_middleware.go
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"time"
)
@steevehook
steevehook / main.go
Created Apr 3, 2019 — forked from creack/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
View main.go
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
@steevehook
steevehook / gist:3cf47ab0f664865c1977ac92f8c82a05
Created Mar 22, 2019 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
View gist:3cf47ab0f664865c1977ac92f8c82a05
$ 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!
View image-tag.sh
if [[ "$(docker images -q iam:${IMAGE_TAG} 2> /dev/null)" == "" ]]; then
docker image ls -q iam | xargs docker image rm -f
buildImage
fi
View Dockerfile
FROM node:alpine as builder
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
RUN npm run build
View marshal_unmarshal.go
package main
import (
"encoding/json"
"fmt"
"bytes"
// "github.com/davecgh/go-spew/spew"
)
/*
View export-env.sh
export $(grep -v '^#' .env-dev | xargs)
You can’t perform that action at this time.