Skip to content

Instantly share code, notes, and snippets.

View dmlyons's full-sized avatar

David Lyons dmlyons

  • Austin, TX
View GitHub Profile
@dmlyons
dmlyons / pgxtimeout.go
Created March 5, 2021 15:12
An example of setting a connection timeout on pgx stdlib
package main
import (
"database/sql"
"log"
"net"
"time"
"github.com/jackc/pgx"
"github.com/jackc/pgx/stdlib"

Keybase proof

I hereby claim:

  • I am dmlyons on github.
  • I am dlyons (https://keybase.io/dlyons) on keybase.
  • I have a public key ASCnwkj-5PfQjF7xD4aBi5fmc2f-6VSaiX8FeDtAKG1TAwo

To claim this, I am signing this object:

FROM armhf/alpine:latest
RUN apk add --no-cache ca-certificates
ENV GOLANG_VERSION 1.8.1
ENV GOLANG_SRC_URL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz
ENV GOLANG_SRC_SHA256 33daf4c03f86120fdfdc66bddf6bfff4661c7ca11c5da473e537f4d69b470e57
RUN set -ex \
&& apk add --no-cache --virtual .build-deps \
@dmlyons
dmlyons / Dockerfile
Last active March 7, 2017 22:24
Docker Protoc generator for Go
FROM golang:1.8-alpine
# Protobuf version
ENV PROTOBUF_VERSION="3.2.0"
ENV PROTOBUF_ZIP=protoc-${PROTOBUF_VERSION}-linux-x86_64.zip
ENV PROTOBUF_URL=https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/${PROTOBUF_ZIP}
#
# Pre-built `protoc` binary will not run on Alpine due to missing of `glibc`,
# so we need to install `glibc` first.
@dmlyons
dmlyons / quotedTimestamp.go
Created May 1, 2015 19:38
A type to use time.Time and quoted numerical timestamps with json marshal/unmarshal
package main
// Liberally used https://medium.com/coding-and-deploying-in-the-cloud/time-stamps-in-golang-abcaf581b72f
import (
"encoding/json"
"fmt"
"strconv"
"time"
)
@dmlyons
dmlyons / go_completion.sh
Last active August 29, 2015 14:20
A bash-completion script that will allow you to jump to specific go source directories with tab completion
function godir {
if [ -z "$1" ]
then
cd $GOPATH/src
else
if [ "$1" == "reload" ]
then
_go_package_names=( $(go list all) )
else
cd $GOPATH/src/$1