Skip to content

Instantly share code, notes, and snippets.

@ronaldpetty
ronaldpetty / low_and_upper.py
Created June 4, 2025 22:26
Meta lower + upper
class MyMeta(type):
def __new__(cls, name, bases, attrs):
mod_attrs = {}
for attr_name, attr_value in attrs.items():
if attr_name.startswith("__"):
mod_attrs[attr_name] = attr_value
continue
cap_name = attr_name.capitalize()
@ronaldpetty
ronaldpetty / fd2repl.py
Created June 4, 2025 15:29
File Description Wrappers and REPL Example
import subprocess
import os
import time
# Start the Python REPL in interactive mode, with a pipe for stdin and stdout
proc = subprocess.Popen(
    ["python3", "-i"],
    stdin=subprocess.PIPE,
    stdout=subprocess.PIPE,
    stderr=subprocess.STDOUT  # Merge stderr into stdout for simplicity
...
- initcontainers
- name: blocker
- command:
- sh
- -x
- -c
- |
broken = true
till_not_broken broken:

k8sgpt

Per https://k8sgpt.ai/

K8sGPT is a tool for scanning your kubernetes clusters, diagnosing and triaging issues in simple english. It has SRE experience codified into its analyzers and helps to pull out the most relevant information to enrich it with AI.

K8sGPT Is For…

  • Workload health analysis - Find critical issues with your workloads.
  • Fast triage, AI analysis - Look at your cluster a glance or use AI to analyze your cluster in depth
@ronaldpetty
ronaldpetty / 1_4_fullsync.md
Created February 22, 2024 05:10
full 1.4 sync
ubuntu@ip-172-31-16-114:~$ script -B forMW.log -T -E always
Script started, output log file is 'forMW.log', input log file is 'forMW.log', timing file is '-E'.
ubuntu@ip-172-31-16-114:~$ kubectl apply -f ./deploykf-app-of-apps.yaml
application.argoproj.io/deploykf-app-of-apps created
ubuntu@ip-172-31-16-114:~$ bash ./deploykf/scripts/sync_argocd_apps.sh

==========================================================================================
Getting admin password from 'Secret/argocd-initial-admin-secret'...
==========================================================================================
ubuntu@ip-172-31-16-114:~$ bash ./deploykf/scripts/sync_argocd_apps.sh >& 1_4_sync.log
ubuntu@ip-172-31-16-114:~$ cat 1_4_sync.log 
E0222 04:27:27.583819  203292 portforward.go:379] error copying from remote stream to local connection: readfrom tcp4 127.0.0.1:40663->127.0.0.1:45624: write tcp4 127.0.0.1:40663->127.0.0.1:45624: write: broken pipe
E0222 04:27:37.892570  203292 portforward.go:379] error copying from remote stream to local connection: readfrom tcp4 127.0.0.1:40663->127.0.0.1:42474: write tcp4 127.0.0.1:40663->127.0.0.1:42474: write: broken pipe
E0222 04:27:37.905920  203292 portforward.go:379] error copying from remote stream to local connection: readfrom tcp4 127.0.0.1:40663->127.0.0.1:42476: write tcp4 127.0.0.1:40663->127.0.0.1:42476: write: broken pipe
time="2024-02-22T04:27:37Z" level=fatal msg="Operation has completed with phase: Failed"
TIMESTAMP                  GROUP                            KIND            NAMESPACE                     NAME                              STATUS    H

WARNING

t3.large (2/8) is not enough (cpu) t3.xlarge (4/16) is not enough (cpu) t3.2xlarge (8/32) trying...

# got "too many files" during kubeflow install
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl fs.inotify.max_user_instances=512
@ronaldpetty
ronaldpetty / kafka-clients-sample.md
Created October 4, 2023 14:26
Kafka client sample
## FORMAT
```
$ curl -sLO https://rx-m-data.s3.us-west-1.amazonaws.com/tree_of_life.zip
$ unzip tree_of_life.zip
[rocky@ip-172-31-22-94 demo_big_graph]$ head -n 2 treeoflife_nodes.csv
node_id,node_name,child_nodes,leaf_node,tolorg_link,extinct,confidence,phylesis
@ronaldpetty
ronaldpetty / md
Created August 19, 2022 18:29
post reboot steps
```
if [ -z ${K8S_VERSION+x} ]; then K8S_VERSION="--kubernetes-version=stable-1" ; else K8S_VERSION="--kubernetes-version=$K8S_VERSION"; fi
sudo kubeadm init --cri-socket=unix:///run/cri-dockerd.sock $K8S_VERSION
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
kubectl taint node --all node-role.kubernetes.io/master-
kubectl taint node --all node-role.kubernetes.io/control-plane-
```