Skip to content

Instantly share code, notes, and snippets.

@timjonesdev
timjonesdev / Dockerfile
Last active February 18, 2019 23:50
Scratch and Sniff
# -------------------------------------------------------
# Build the go source
# -------------------------------------------------------
FROM docker.io/golang:1.11 as go-builder
# copy simple go application into the container
COPY sniff.go $GOPATH/src/app/sniff.go
# change the working directory, for convenience
WORKDIR $GOPATH/src/app
# build the Go binary and create some directories to copy in later stages
@timjonesdev
timjonesdev / Dockerfile
Created February 18, 2019 23:49
A Composite Dockerfile
# -------------------------------------------------------
# Build the go source
# -------------------------------------------------------
FROM docker.io/golang:1.11 as go-builder
# copy simple go application into the container
COPY app/api/main.go $GOPATH/src/app/main.go
# change the working directory, for convenience
WORKDIR $GOPATH/src/app
# build the Go binary and create some directories to copy in later stages
@timjonesdev
timjonesdev / sniff.go
Created February 18, 2019 23:50
A simple health check Go application
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
// Could/should make this configurable
apiVersion: v1
kind: Pod
metadata:
labels:
test: liveness
name: liveness-exec
spec:
containers:
- name: liveness
image: k8s.gcr.io/busybox
apiVersion: v1
kind: Pod
metadata:
labels:
test: liveness
name: liveness-exec
spec:
containers:
- name: liveness
image: k8s.gcr.io/busybox

Calculation of Projected Order Expiration

Sorting based on relative expiration time.

Algebra for calculating when value will equal zero: We project when value will equal zero, and compare number of seconds

v = (s - x) - (d * x)

Solve for the slope-intercept form:

v = -dx - x + s

v = -(d + 1)x + s

module github.com/samplerepo/sampleproject
go 1.12
require (
github.com/pkg/errors v0.8.0
github.com/spf13/cobra v0.0.4
github.com/spf13/viper v1.3.2
)
git config \
--global \
url."https://${bitbucket_id}:${bitbucket_token}@privatebitbucket.com".insteadOf \
"https://privatebitbucket.com"
git config \
--global \
url."https://oauth2:${personal_access_token}@privategitlab.com".insteadOf \
"https://privategitlab.com"
#or
git config \
--global \
url."https://${user}:${personal_access_token}@privategitlab.com".insteadOf \
git config \
--global \
url."https://${user}:${personal_access_token}@github.com".insteadOf \
"https://github.com"