Skip to content

Instantly share code, notes, and snippets.

@veggiemonk
veggiemonk / PodDisruptionBudget.yaml
Created July 15, 2019 11:55
GKE kubernetes upgrade
kind: PodDisruptionBudget
metadata:
name: my-app
spec:
maxUnavailable: 1
selector:
matchLabels:
app: my-app
@veggiemonk
veggiemonk / Dockerfile
Last active July 11, 2019 10:13
Build GO app in multi-stage container
FROM golang:alpine AS builder
ARG GITHUB_USER
ARG REPO_NAME
WORKDIR /go/src/github.com/$GITHUB_USER/$REPO_NAME/
COPY . .
RUN apk add --no-cache \
@veggiemonk
veggiemonk / git_update_subfolder.sh
Last active July 9, 2019 19:54
organize your git repo like go
#!/bin/bash
for r in *;
do {
echo ">>> $r" && \
cd $r && \
(git pull || echo 0) && \
cd ..
};
done;
@veggiemonk
veggiemonk / README.md
Last active June 26, 2019 13:49
TERRAFORM workshop 2

Terraform

  1. take the code from the previous workshop -> https://gist.github.com/veggiemonk/097890ff101a995f3c31f4d25b69665e
  2. install terraform 0.12 => https://releases.hashicorp.com/terraform/0.12.3/terraform_0.12.3_linux_amd64.zip
  3. convert it to Terraform 0.12 by using the command terraform 0.12upgrade
  4. make sure it works (terraform plan, terraform apply and terraform destroy)
  5. spit into modules. https://www.terraform.io/docs/modules/index.html
  6. manually go into the console, create a small VM and try to import it into the terraform state -> see https://www.terraform.io/docs/import/usage.html
  7. destroy everything.
@veggiemonk
veggiemonk / container-common-fluff.go
Last active July 9, 2019 12:11
FLUFF - connecting pipes
package main
import (
"context"
"fmt"
"net"
"net/http"
"os"
"os/signal"
"runtime"
@veggiemonk
veggiemonk / .zsh_alias
Last active August 22, 2019 13:57
Shell alias
alias ez="vim ~/.zshrc && source ~/.zshrc"
alias c="clear"
alias path='echo -e ${PATH//:/\\n}'
alias dpsa="docker ps -a"
alias dcup="docker-compose up"
alias dcupd="docker-compose up -d"
alias dcdn="docker-compose down"
alias dclf="docker-compose logs -f"
alias server="python3 -m http.server"
@veggiemonk
veggiemonk / 1_terraform_workshop_tips.md
Last active June 26, 2019 11:49
Terraform gcp workshop

Terraform

Install

mkdir -p $HOME/bin
cd $HOME/bin
wget https://releases.hashicorp.com/terraform/0.11.9/terraform_0.11.9_linux_amd64.zip
unzip terraform_0.11.9_linux_amd64.zip
export PATH="$PATH:$HOME/bin"
@veggiemonk
veggiemonk / main.go
Created May 17, 2019 14:27
forseti-viz server in csv
package main
import (
"database/sql"
"fmt"
"net/http"
"os"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"