Skip to content

Instantly share code, notes, and snippets.

View esweeney-cg's full-sized avatar

Ed Sweeney esweeney-cg

View GitHub Profile
@esweeney-cg
esweeney-cg / takeout_fix.py
Created October 9, 2024 15:37
convert google keep files from takeout json to markdown for zet
import os
import json
import datetime
import random
import string
import re
def format_date_for_filename(timestamp_usec):
"""Convert timestamp (in microseconds) to a numerical date string for filenames"""
@esweeney-cg
esweeney-cg / flux2.md
Created June 18, 2024 02:49
flux v2 upgrade
find . -type f -name "*.yaml" -exec sed -i '' 's/apiVersion: kustomize.toolkit.fluxcd.io\/v1beta2/apiVersion: kustomize.toolkit.fluxcd.io\/v1/g' {} +
find . -type f -name "*.yaml" -exec sed -i '' 's/apiVersion: source.toolkit.fluxcd.io\/v1beta1/apiVersion: source.toolkit.fluxcd.io\/v1/g' {} +
@esweeney-cg
esweeney-cg / sprints.py
Created June 14, 2024 14:51
calculate sprints
from datetime import datetime, timedelta
def calculate_sprints(initial_sprint_name, initial_start_date):
sprints = []
sprint_letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
current_sprint_name = initial_sprint_name
current_start_date = datetime.strptime(initial_start_date, "%m/%d/%Y")
sprint_duration = timedelta(days=11)
@esweeney-cg
esweeney-cg / cmd.sh
Created July 26, 2023 00:24
kubectl kong plugin ipr-global for egress
k describe kongclusterplugins.configuration.konghq.com kong-myco-ipr-global
@esweeney-cg
esweeney-cg / fetch_cloudwatch_hours.sh
Created July 12, 2023 00:11
get the prev days logins using a particular role
#!/usr/bin/env bash
# Check if username argument is passed
if [ -z "$1" ]
then
echo "No argument supplied. Please provide username as an argument."
exit 1
fi
username="$1" # The username is taken from the first command line argument
@esweeney-cg
esweeney-cg / startq_day.sh
Last active July 11, 2023 23:58
bash script to scrape cloudwtch logs for logins
#!/usr/bin/env bash
# Check if username argument is passed
if [ -z "$1" ]
then
echo "No argument supplied. Please provide username as an argument."
exit 1
fi
username="$1" # The username is taken from the first command line argument
@esweeney-cg
esweeney-cg / revert.md
Last active June 1, 2023 20:04
git revert

when reverting multiple commits from main where: A <- B <- C <- D and D is the most recent

git checkout -b my-revert-branch
git revert --no-commit D
git revert --no-commit C
@esweeney-cg
esweeney-cg / tdump-rpt.py
Created April 26, 2023 14:47
create a cpu score for threads from a thread dump
#!/usr/bin/env python3
import sys
import re
from collections import defaultdict
def parse_thread_dump(content):
thread_pattern =\
r'"(.*?)"\s+#\d+\s+.*?cpu=(.*?)ms\s+elapsed=(.*?)s\s+tid=.*'
@esweeney-cg
esweeney-cg / opensslpem.sh
Created April 14, 2023 18:14
openssl pem file decoder
openssl x509 -in certificate.crt -text -noout
@esweeney-cg
esweeney-cg / k9s.txt
Created March 8, 2023 20:44 — forked from BigNerd/k9s.txt
K9s column descriptions
View: Pods(<namespace>)[number of pods listed]
NAME pod name
READY number of pods in ready state / number of pods to be in ready state
RESTARTS number of times the pod has been restarted so far
STATUS state of the pod life cycle, such as Running | ... | Completed
CPU current CPU usage, unit is milli-vCPU
MEM current main memory usage, unit is MiB
%CPU/R current CPU usage as a percentage of what has been requested by the pod
%MEM/R current main memory usage as a percentage of what has been requested by the pod