Skip to content

Instantly share code, notes, and snippets.

Jason Hall ImJasonH

Block or report user

Report or block ImJasonH

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 clear.sh
#!/bin/bash
while read l; do
echo Removing $l
docker image rm $l
done < images.txt
View Dockerfile
FROM golang:latest
RUN mkdir /app
ADD . /app/
WORKDIR /app
RUN go build -o helloworld .
CMD ["/app/helloworld"]
@ImJasonH
ImJasonH / pod.yaml
Last active Jun 28, 2018
Repro pod that fails to start since init container isn't found
View pod.yaml
Warning FailedMount 1m (x8 over 2m) kubelet, gke-cluster-1-default-pool-f1d9d3b1-x598 MountVolume.SetUp failed for volume "podinfo-init" : container init not found
Warning FailedMount 3s kubelet, gke-cluster-1-default-pool-f1d9d3b1-x598 Unable to mount volumes for pod "pod_default(bdca098f-7b0a-11e8-b5dd-42010a8e007f)": timeout expired waiting for volumes to attach or mount for pod "default"/"pod". list of unmounted volumes=[podinfo-init]. list of unattached volumes=[podinfo-init podinfo-real default-token-pkttv]
@ImJasonH
ImJasonH / example
Created Jun 7, 2018
Demonstrate connecting to GKE cluster from outside, starting pod, grabbing logs
View example
$ go run main.go -tok=$(gcloud auth print-access-token) -project=$(gcloud config get-value core/project)
There are 41 pods in the cluster
...
There are 3 nodes in the cluster
-> gke-cluster-1-default-pool-968a07e0-bw9p
-> gke-cluster-1-default-pool-968a07e0-gxzx
-> gke-cluster-1-default-pool-968a07e0-xrdh
Created pod foo-k4twr
container "noop" in pod "foo-k4twr" is waiting to start: ContainerCreating
container "noop" in pod "foo-k4twr" is waiting to start: ContainerCreating
View Dockerfile
FROM ubuntu
RUN apt-get update && apt-get -y install python3
@ImJasonH
ImJasonH / main.go
Last active Mar 29, 2018
Text-to-Speech-to-Text-to-Speech ad infinitum
View main.go
package main
import (
"context"
"errors"
"flag"
"fmt"
"log"
"math/rand"
"os"
@ImJasonH
ImJasonH / auth.go
Created Mar 5, 2018
Docker registry API client transport that invokes configured creds helpers
View auth.go
package registry
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
@ImJasonH
ImJasonH / BUILD
Last active Jan 5, 2018
Experiment to build a docker builder image that includes only static docker binaries, using Bazel
View BUILD
load(
"@io_bazel_rules_docker//docker:docker.bzl",
"docker_build",
)
docker_build(
name = "target",
base = "@base_image//image:image.tar",
directory = "/bin",
entrypoint = ["/bin/docker"],
@ImJasonH
ImJasonH / main.go
Created Oct 20, 2017
Example writing newline-delimited JSON to a writer (pipe) and reading from it.
View main.go
package main
import (
"encoding/json"
"fmt"
"io"
"log"
)
func main() {
@ImJasonH
ImJasonH / app.go
Last active Jun 27, 2017
Markov chain generator based on Breitbart comments
View app.go
package markov
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io"
"math/rand"
"net/http"
You can’t perform that action at this time.