Skip to content

Instantly share code, notes, and snippets.

View nastacio's full-sized avatar

Denilson Nastacio nastacio

View GitHub Profile
@nastacio
nastacio / argocd-delete-prevent-summary.md
Last active September 2, 2025 14:06
Summary table for Argo CD deletion
Policy Goal Trade-offs Reference
1. ApplicationSet syncPolicy Control creation, update, and deletion of generated Applications + Fine-grained lifecycle control; prevents costly deletions.
– Overrides may not be enabled; risk of misconfiguration.
Docs: ApplicationSet spec
2. ApplicationSet preserveResourcesOnDeletion Prevent cascading deletion of Application-managed resources + Avoids mass resource deletion when Applications are removed.– May leave orphaned resources requiring manual cleanup. [Docs: ApplicationSet spec](https://argo-cd.readthedocs.i
@nastacio
nastacio / cpp-notes.txt
Last active July 10, 2025 16:26
cpp-notes.txt
# parse input
#include <sstream>
#include <vector>
#include <iostream>
using namespace std;
vector<int> parseInts(string str) {
vector<int> *result = new vector<int>();
stringstream ss(str);
@nastacio
nastacio / python-notes.txt
Last active July 10, 2025 13:56
My Python Notes
#!/bin/python3
import math
import os
import random
import re
import sys
#
@nastacio
nastacio / AI draft to prompt for instructions
Last active June 10, 2024 21:48
AI Response to prompt
Original Prompt
> Write the step-by-step instructions for the following problem, grouping the information in sections titled "Overview," "Prerequisites," "Steps," "Validation," "Troubleshooting," and "References."
>
> I want the result in markdown format that I can use on a README.md file.
>
> On each step, add a "Command reference" link to the original documentation page describing the commands.
>
> Here is the problem:
>
@nastacio
nastacio / kubenstein-output-0.0.1.md
Created October 8, 2023 14:05
Transcription of Kubenstein v0.0.1 Troubleshooting Session

kubenstein:

You are a Kubernetes administrator asked to validate whether a cluster is running properly.

I am logged in to the cluster as a system administrator and can invoke the "kubectl" command-line interface from a terminal.

It is extremely important that you give me a single command at a time and wait for me to execute the command and give you the output.

Whenever you give me a command, observe the rules in this list named "prompt-rules":
@nastacio
nastacio / create-machine-set.sh
Last active October 19, 2022 01:11
Clone and modify machine sets in OCP cluster
#!/bin/sh
infra_id=$(kubectl get Infrastructure cluster -o jsonpath='{.status.infrastructureName}')
instance_size=${1:-c5a.xlarge}
kubectl get MachineSet \
-n openshift-machine-api \
-l hive.openshift.io/machine-pool=worker \
-l hive.openshift.io/managed=true \
-o yaml \
@nastacio
nastacio / kubectl-probes.sh
Created December 22, 2021 05:16
kubectl cheatsheet for container probes
# All containers, probes, restarts, duration of startup, and an assessment of probe settings relative to the startup time:
cat<<EOF > podlist.gotemplate
{{- range .items -}}{{\$pod := .}}
{{- .metadata.name -}}{{- "," -}}
{{- .metadata.namespace -}}{{- "," -}}
{{- range .status.conditions -}}
{{- if eq .type "PodScheduled" -}}
{{- .lastTransitionTime -}}
{{- end -}}
@nastacio
nastacio / delete_k8s_namespace.sh
Created May 19, 2021 15:58
Force deletion of k8s namespace
function delete_namespace() {
local namespace=${1}
kubectl get namespace ${namespace} -o jsonpath={.status.conditions} \
| jq '.[] | select(.type=="NamespaceContentRemaining" and .reason=="SomeResourcesRemain") .message' \
| sed "s| |\\n|g" | grep "\." \
| xargs -Iresource oc get resource -n ${namespace} -o name \
| xargs -I r2 oc patch r2 -n ${namespace} --type=merge --patch '{"metadata":{"finalizers":[]}}'
}
delete_namespace ${1}
#
# Updates the target branch for all ArgoCD applications on a namespace
#
# arg1 name of the new gitops branch
# arg2 namespace for the ArgoCD applications to be patched
#
function set_argo_branch() {
local new_branch=${1}
local namespace=${2:-openshift-gitops}
@nastacio
nastacio / gist:58fda519094746d75614fb630e9b6a0f
Created November 22, 2019 11:53
DB2 local instance with sample database
### (Optional) Create local DB2 instance
#### Create local network
```
docker network create workshop_nw
```
#### Create DB2 database (local docker container)