Skip to content

Instantly share code, notes, and snippets.

View noqcks's full-sized avatar
🏠
Working from home

Benji Visser noqcks

🏠
Working from home
View GitHub Profile
@noqcks
noqcks / ejson.sh
Last active December 24, 2018 17:47
#!/bin/sh
set -eo pipefail
# get ejson2env
wget -q https://gist.github.com/noqcks/88304840eb85e6d7ac6d3dcfe1fa9bc4/raw/e8d7beaa89ec8a819489852d023dc641b027748c/ejson2env
chmod +x ejson2env
mv ejson2env /usr/bin/ejson2env
# exit if $ENV doesn't exist. Not sure what environment to decrypt!
@noqcks
noqcks / main.go
Created December 6, 2018 15:53
Kubernetes go-client deployment patching.
package main
// the equivalent of kubectl set image deployment/api api="image"
import (
"fmt"
patchtype "k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
"k8s.io/client-go/rest"
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: airflow-scheduler
namespace: airflow
---
# Allows Airflow to grab config maps (airflow.cfg)
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
@noqcks
noqcks / Makefile
Created October 3, 2018 14:31
Development setup
.PHONY: app api chat api_worker setup
setup:
brew install yarn
brew install rabbitmq
brew install mongodb
brew install redis
app:
cd app/ && yarn
@noqcks
noqcks / pci.sh
Last active August 20, 2018 13:24
PCI Output
#!/bin/bash
# run as './task.sh >> $(hostname)-$(date +%Y-%m-%d).txt 2>&1'
set -e
set -x
ssh -V
# list interfaces
---
version: '3'
services:
node:
image: node:9
ports:
- 8002:8002
env_file: .env
volumes:
- ./:/usr/src/app:nocopy
@noqcks
noqcks / node:9
Created May 11, 2018 22:07
Dockerfile
FROM node:9-alpine
# node-sass requirements...
RUN apk --no-cache add --virtual native-deps g++ gcc libgcc libstdc++ \
linux-headers make python && \
apk del native-deps
WORKDIR /usr/src/app
COPY entrypoint.sh /entrypoint.sh
---
apiVersion: audit.k8s.io/v1beta1
kind: Policy
rules:
— level: RequestResponse
omitStages:
— RequestReceived
resources:
— group: ""
{
"kind":"Event",
"apiVersion":"audit.k8s.io/v1beta1",
"metadata":{ "creationTimestamp":"2018-03-21T21:47:07Z" },
"level":"Metadata",
"timestamp":"2018-03-21T21:47:07Z",
"auditID":"20ac14d3-1214-42b8-af3c-31454f6d7dfb",
"stage":"RequestReceived",
"requestURI":"/api/v1/namespaces/default/persistentvolumeclaims",
"verb":"list",
---
apiVersion: audit.k8s.io/v1beta1
kind: Policy
rules:
— level: Metadata
omitStages:
— RequestReceived