Skip to content

Instantly share code, notes, and snippets.

View denniswebb's full-sized avatar

Dennis Webb denniswebb

View GitHub Profile
@denniswebb
denniswebb / resume.json
Created September 20, 2022 18:50
Resume
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Dennis Webb",
"label": "Staff Software Engineer at Panther",
"image": "",
"email": "[email protected]",
"phone": "901-209-9322",
"url": "",
"summary": "I am a DevOps Engineer currently helping businesses deploy and manage their infrastructure and applications with Amazon Web Services. 20 years of IT experience has allowed me to continuously increase my knowledge and improve my skills. I am also a member of the AWS \"All 9 Club\" by holding all 9 of the AWS Certifcations.\n\nI believe that DevOps should provide solutions that allow deployments to be almost \"self-service\" to the developer. A good DevOps department provides tools so a developer can simply add a few deployment parameters in their repo, and the system built by DevOps handles the rest for them. My job is to allow developers to do what they do best, and that's to keep coding.\n\nI am convinced in the
# Prepare cluster
# helm install --name cert-manager --namespace=cert-manager jetstack/cert-manager --version v0.10.1
# kubectl label namespace cert-manager certmanager.k8s.io/disable-validation=true
# kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v0.10.1/cert-manager.yaml
# helm install istio.io/istio-init --name istio-init --namespace istio-system
# helm install istio.io/istio --name istio --namespace istio-system --set-string gateways.istio-ingressgateway.sds.enabled=true
# kubectl label ns default istio-injection=enabled
apiVersion: v1
kind: Service
@denniswebb
denniswebb / k8s-job-from-cron
Created February 17, 2018 20:14
Run Kubernetes CronJob on Demand
#!/usr/bin/env bash
usage () {
echo "Usage: $(basename "$0") <cronjob_name>"
exit 1
}
if [ -z "$1" ]; then usage; fi
kubectl get cronjob "$1" -ojson | jq '{ "apiVersion": "batch/v1", "kind": "Job", "metadata": {"name": .metadata.name }, "spec": .spec.jobTemplate.spec }' | kubectl apply -f -
@denniswebb
denniswebb / mfaup.sh
Created February 13, 2018 18:22
Creates MFA AWS Profile for base profile
#!/usr/bin/env bash
token=$1
aws_account=132456
base_profile=work
mfa_profile=workmfa
username=denniswebb
creds=$(aws --profile ${base_profile} sts get-session-token --serial-number arn:aws:iam::${aws_account}:mfa/${username} --duration 129600 --token $token --query "Credentials.[AccessKeyId, SecretAccessKey, SessionToken]" --output text)
@denniswebb
denniswebb / circleci-api.md
Last active January 29, 2018 20:04
CircleCI API

Get all repos on CircleCI

curl "https://circleci.com/api/v1.1/projects?circle-token=$CIRCLE_TOKEN" | jq -r '.[] | .username + "/" + .reponame'

Set slack_webhook_url for a single repo

curl -XPUT --header "Content-Type: application/json" "https://circleci.com/api/v1.1/project/github/MyOrg/MyRepo/settings?circle-token=$CIRCLE_TOKEN" -d '{"slack_webhook_url":"https://hooks.slack.com/services/FSFDSFDS?DSFHJKHDFKJSDH"}'

Put it all together to setup webhooks for all of your repos

@denniswebb
denniswebb / k8s-secret-cp
Created January 26, 2018 15:28
Copy Kubernetes secret from 1 namespace to another
#!/usr/bin/env bash
SECRET_NAME=$1
SRC_NS=$2
DST_NS=$3
kubectl -n ${SRC_NS} get secret ${SECRET_NAME} -o yaml | sed "/resourceVersion/d" | sed "/creationTime/d" | sed "/selfLink/d" | sed "/uid/d" | sed "s/namespace: ${SRC_NS}/namespace: ${DST_NS}/g" | kubectl apply -f -
@denniswebb
denniswebb / rancher.yaml
Created January 20, 2018 23:12
userdata for single host RancherOS
#cloud-config
hostname: rancher-ergon
rancher:
console: debian
services:
rancher-server:
image: rancher/server
command: --db-host mysql.denniswebb.info
restart: always
ports:
@denniswebb
denniswebb / SplitAfterNSize
Created December 5, 2017 19:31
Golang function to split a string by size on a separator.
func StringSplitAfterNSize(s, sep string, size int) (resp []string) {
rl := ""
for _, line := range strings.SplitAfter(s, sep) {
if len(rl+line) > size {
resp = append(resp, rl)
rl = ""
}
rl += line
}
if len(resp) > 0 && len(rl) == 0 {
package main
import "reflect"
func FieldValueByTag(s interface{}, tag, tagValue string) interface{} {
t := reflect.TypeOf(s)
for i := 0; i < t.NumField(); i++ {
if tagValue == t.Field(i).Tag.Get(tag) {
return reflect.ValueOf(s).FieldByName(t.Field(i).Name)
variable "github_token" {}
provider "github" {
organization = "denniswebb"
token = "${var.github_token}"
}
module "datadog-openvpn" {
source = "modules/github"