Skip to content

Instantly share code, notes, and snippets.

@dschaaff
dschaaff / cert-renew.sh
Last active October 30, 2022 18:30
Force a renewal cert-manager issued certificates in kubernetes.
#!/bin/bash
set -euo pipefail
namespaces="$(kubectl get namespaces -o json | jq -r '.items[] | .metadata.name')"
for name in $namespaces
do
certificates="$(kubectl get certificates -n $name -o json | jq -r '.items[] | .metadata.name')"
for cert in $certificates
do
kubectl patch certificate "$cert" -n "$name" -p '[{"op": "add", "path": "/spec/renewBefore", "value":"2159h59m30s"}]' --type='json'
#kubectl patch certificate "$cert" -n "$name" -p '[{"op": "remove", "path": "/spec/renewBefore"}]' --type='json'
@dschaaff
dschaaff / GPG and git on macOS.md
Created December 20, 2019 17:51 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys

Keybase proof

I hereby claim:

  • I am dschaaff on github.
  • I am dschaaff (https://keybase.io/dschaaff) on keybase.
  • I have a public key ASB_5GCI8yjya8f9_OjmtwpDEJpv5fiZ0HUlqjLLS2LFiAo

To claim this, I am signing this object:

# stdlib
import time
# 3rd party
import boto3
# datadog
from checks import AgentCheck
client = boto3.client('s3')
@dschaaff
dschaaff / notifySlack.groovy
Created February 9, 2018 18:18
jenkins pipeline library for slack notifications with nice formatting
#!/usr/bin/env groovy
/**
* notify slack and set message based on build status
*/
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import hudson.tasks.test.AbstractTestResultAction;
import hudson.model.Actionable;
#!/usr/bin/env python
import requests
import sys
import json
from datetime import date, timedelta
#Your PagerDuty API key. A read-only key will work for this.
AUTH_TOKEN = 'YOUR_API_KEY'
#The API base url, make sure to include the subdomain