Skip to content

Instantly share code, notes, and snippets.

@mclarke47
mclarke47 / gist:58d90f2dcd5974dae6a359114cd16615
Created July 10, 2024 15:12
Add all CVS coupons to your rewards card without clicking the buttons
document.querySelectorAll(".coupon-action.button-blue").forEach((f, i) => {
setTimeout(() => {
f.click()
}, 1500 * i)
})
@mclarke47
mclarke47 / controller-logs.txt
Created November 13, 2023 13:47
stuck-rs-ar
initialDeploy: false" namespace=some-service rollout=some-service
time="2023-11-13T13:24:00Z" level=error msg="roCtx.reconcile err Operation cannot be fulfilled on replicasets.apps \"some-service-c94d4464d\": the object has been modified; please apply your changes to the latest version and try again" generation=149 namespace=some-service resourceVersion=2336947719 rollout=some-service
time="2023-11-13T13:24:00Z" level=info msg="Reconciliation completed" generation=149 namespace=some-service resourceVersion=2336947719 rollout=some-service time_ms=40.583420000000004
time="2023-11-13T13:24:00Z" level=error msg="rollout syncHandler error: Operation cannot be fulfilled on replicasets.apps \"some-service-c94d4464d\": the object has been modified; please apply your changes to the latest version and try again" namespace=some-service rollout=some-service
time="2023-11-13T13:24:00Z" level=info msg="rollout syncHandler queue retries: 147 : key \"some-service/some-service\"" namespace=some-service rollout=some-service
t
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: dice-roller
description: It rolls dice
tags:
- go
annotations:
"backstage.io/kubernetes": dice-roller
spec:
@mclarke47
mclarke47 / kubectl-restarts.sh
Created June 6, 2018 09:11
Sort pods by restart count
kubectl get pods --sort-by='.status.containerStatuses[0].restartCount'
@mclarke47
mclarke47 / gen-refresh.sh
Last active March 23, 2018 11:01
Generate a script to delete all kubernetes service account token
kubectl get secrets --all-namespaces -o=json | jq -r '.items[] | select(.type=="kubernetes.io/service-account-token") | "kubectl delete secret \(.metadata.name) -n \(.metadata.namespace)"' > refresh-api-tokens.sh
@mclarke47
mclarke47 / delay-delete.sh
Created February 28, 2018 11:30
deletes pods with a delay
#!/usr/bin/env bash
kubectl get po -l app=$1 -o=json | jq -r '.items[].metadata.name' | while read object; do
echo "rebooting $object"
kubectl delete po "$object"
sleep 180
done
import java.util.Arrays;
public class LCS {
public static void main(String[] args) {
String str1 = "FAGGTAB";
String str2 = "FGXTXAYB";
int[][] matrix = buildMatrix(str1, str2);
@mclarke47
mclarke47 / delayed-delete
Created September 25, 2017 09:56
Kubernetes effective restart with delay by app label
#!/usr/bin/env bash
kubectl get po -l app=$1 -o=json | jq -r '.items[].metadata.name' | while read object; do
kubectl delete po "$object"
sleep 180
done
@mclarke47
mclarke47 / sg-delete.sh
Created July 18, 2017 17:45
AWS delete all the security groups with the matching description
aws ec2 describe-security-groups | jq -r '.SecurityGroups[] | select(.Description | contains("ingress")) | .GroupId' |xargs -I % aws ec2 delete-security-group --group-id %
@mclarke47
mclarke47 / last-success.sh
Created July 4, 2017 13:11
get last successful or fixed circleci build number
curl -s https://circleci.com/api/v1.1/project/github/user/repo?circle-token=<token> | jq '[.[] | select(.status=="success" or .status=="fixed")] | max_by(.build_num).build_num'