Skip to content

Instantly share code, notes, and snippets.

View developer-guy's full-sized avatar
🐾
Every artifact can be verifiably traced to Source Code and Hardware

Batuhan Apaydın developer-guy

🐾
Every artifact can be verifiably traced to Source Code and Hardware
View GitHub Profile
apiVersion: constraints.gatekeeper.sh/v1beta1
kind: LBTypeSvcNotAllowed
metadata:
name: deny-lb-type-svc-dev-ns
spec:
match:
kinds:
- apiGroups: [""]
kinds: ["Service"]
namespaces:
@developer-guy
developer-guy / deny-lb-type-svc.yaml
Created November 30, 2020 19:33 — forked from velotiotech/deny-lb-type-svc.yaml
Constraint Template to deny service of type LoadBalancer
apiVersion: templates.gatekeeper.sh/v1beta1
kind: ConstraintTemplate
metadata:
name: lbtypesvcnotallowed
spec:
crd:
spec:
names:
kind: LBTypeSvcNotAllowed
listKind: LBTypeSvcNotAllowedList
@developer-guy
developer-guy / getPassword.go
Created November 30, 2020 12:53 — forked from jlinoff/getPassword.go
Go code to prompt for password using only standard packages by utilizing syscall.ForkExec() and syscall.Wait4(), recovers from ^C gracefully.
// License: MIT Open Source
// Copyright (c) Joe Linoff 2016
// Go code to prompt for password using only standard packages by utilizing syscall.ForkExec() and syscall.Wait4().
// Correctly resets terminal echo after ^C interrupts.
package main
import (
"bufio"
"fmt"
"os"
@developer-guy
developer-guy / 02-issue-greeter.yml
Created November 27, 2020 07:50 — forked from weibeld/02-issue-greeter.yml
GitHub Actions example workflow 2 — Issue Greeter
name: issue-greeter
on:
issues:
types: [opened]
jobs:
my-job:
runs-on: ubuntu-latest
steps:
- name: my-step
env:
@developer-guy
developer-guy / 01-hello-world.yml
Created November 27, 2020 07:44 — forked from weibeld/01-hello-world.yml
GitHub Actions example workflow 1 — Hello World!
name: hello-world
on: push
jobs:
my-job:
runs-on: ubuntu-latest
steps:
- name: my-step
run: echo "Hello World!"
version: "3.7"
services:
envoy:
build: ./compose/envoy
ports:
- "8080:80"
volumes:
- ./envoy.yaml:/config/envoy.yaml
environment:
- DEBUG_LEVEL=info
@developer-guy
developer-guy / docker_attach
Created November 19, 2020 07:30 — forked from miki725/docker_attach
Attach to docker container via nsenter
#!/bin/bash
USAGE="Attach to Docker Container
--------------------------
Attach to Docker Container even if the container does not run
ssh daemon. This is accomplished by using linux containers
directly via 'nsenter' (see http://bit.ly/docker_nsenter).
To install 'nsenter', just execute:
$ docker run -v /usr/local/bin:/target jpetazzo/nsenter
@developer-guy
developer-guy / Dockerfile
Created November 10, 2020 10:33 — forked from avishayp/Dockerfile
Add non-root user for alpine linux
# non root user example for alpine
#
# usage:
# $ docker build --build-arg "USER=someuser" --tag test .
# $ docker run --rm test
FROM alpine
ARG USER=default
ENV HOME /home/$USER
@developer-guy
developer-guy / kubectl.md
Created November 8, 2020 21:12 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@developer-guy
developer-guy / one_liner.sh
Created November 8, 2020 15:18 — forked from zparnold/one_liner.sh
A simply script to delete all failed pods from Kubernetes
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod