Skip to content

Instantly share code, notes, and snippets.

View jmhublar's full-sized avatar
☘️
🐝

Joshua Hublar jmhublar

☘️
🐝
View GitHub Profile
@jmhublar
jmhublar / get_liked.py
Created November 16, 2023 07:02
List liked youtubes.
import os
import google_auth_oauthlib.flow
import googleapiclient.discovery
import googleapiclient.errors
scopes = ["https://www.googleapis.com/auth/youtube.readonly"]
def main():
# Disable OAuthlib's HTTPS verification when running locally.
# *DO NOT* leave this option enabled in production.
import requests
import json
import argparse
# Set up command-line argument parsing
parser = argparse.ArgumentParser(description='Check for duplicate metrics in Prometheus.')
parser.add_argument('url', help='The URL of the Prometheus server.')
args = parser.parse_args()
# Get all metric names
@jmhublar
jmhublar / all_probe_paths.sh
Created June 22, 2023 19:49
Audit liveness and readiness probe endpoints
#!/bin/bash
all_probe_paths=()
for ns in $(kubectl get namespaces -o jsonpath='{.items[*].metadata.name}'); do
readiness_probes=$(kubectl -n $ns get deployments -o jsonpath='{range .items[*]}{.spec.template.spec.containers[0].readinessProbe.httpGet.path}{","}{end}')
liveness_probes=$(kubectl -n $ns get deployments -o jsonpath='{range .items[*]}{.spec.template.spec.containers[0].livenessProbe.httpGet.path}{","}{end}')
if [ ! -z "$readiness_probes" ]; then
all_probe_paths+=${readiness_probes}
@jmhublar
jmhublar / heavy_work.sh
Last active May 23, 2023 20:53
Handy little progressbar for bash
#!/bin/bash
source progressbar.sh
# bar customization
bar_size=70
bar_char_done="|"
bar_char_todo=" "
bar_percentage_scale=4
@jmhublar
jmhublar / doit2it.sh
Created March 27, 2023 02:52
A little script to ease the pain of restoring pulsar pvcs
!/bin/bash
# Set source and destination folders
SOURCE_FOLDER="/efs-new/aws-backup-restore_2023-03-27T00-28-30-414788Z/csi/"
DESTINATION_FOLDER="/efs-new/csi/"
DRY_RUN=false
if [ "$1" == "--dry-run" ]; then
DRY_RUN=true
@jmhublar
jmhublar / Token Utilities
Last active March 15, 2023 03:53
A few token utilities
Token Utilities
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
namespace: pulsar
creationTimestamp: null
labels:
app: kube-prometheus-stack
release: prometheus-operator
name: pleaseignore
spec: