Skip to content

Instantly share code, notes, and snippets.

View juandspy's full-sized avatar
👨‍💻

Juan Díaz juandspy

👨‍💻
View GitHub Profile
@juandspy
juandspy / .gitignore
Last active July 10, 2024 10:41
Check Unleash gradual rollout stickiness
.env
@juandspy
juandspy / README.md
Last active March 20, 2024 09:10
Utility functions for dealing with multiple git repositories

Utility functions for dealing with multiple git repositories

Adding a file to multiple repos

Edit any variable in the shell script. Then run it this way:

./add-file-to-repos.sh 2>&1 | tee out.log
@juandspy
juandspy / README.md
Last active October 19, 2023 15:32
Get OpenShift resources including the Helm release

Compare Helm chart with deployed workflows

Get all the Helm resources that are deployed in the cluster

echo "KIND,NAME,NAMESPACE,HELM_RELEASE" > resources.csv
source main.sh
namespaces=("ccx-prod" "ccx-qa" "ccx-supplementary"); for ns in "${namespaces[@]}";
    get_resources "$ns" | awk '{$1=$1; OFS=",";} 1' |
 grep -v -E 'Pod|Job|ReplicationController|ReplicaSet' | awk -F, '$1 != "Build"' >> resources.csv
@juandspy
juandspy / README.md
Last active October 6, 2023 14:23
Useful git commands

Useful git commands

I'm using zsh's git plugin for the alias like gp.

  1. Check out the master/main (default) branch for the repo and pull the latest changes.
DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch" | sed 's/.*: //') && \
  git checkout "$DEFAULT_BRANCH" && \
 git pull origin "$DEFAULT_BRANCH"
@juandspy
juandspy / main.sh
Created September 19, 2023 08:23
Get resource quotas for your oc projects in a CSV
#/bin/bash
namespaces=$(oc get projects -o template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
echo "Namespace,Name,Type,Limits CPU,Limits Memory,PersistentVolumeClaims,Pods,Requests Storage"
for namespace in $namespaces
do
for type in "hard" "used"
do
@juandspy
juandspy / .gitignore
Last active May 23, 2023 07:01
CCXDEV-11016
*.dat
@juandspy
juandspy / README.md
Last active May 23, 2023 07:03
Query app-interface's queues

App interface's queues

In order to quickly check the status of your Merge Request, you can run these two commands.

Note that a MR needs to be reviewed before entering the merge queue. That's why checking both is sometimes needed.

Prerequisites

Install glow or use your favourite markdown renderer.

@juandspy
juandspy / README.md
Created August 23, 2022 12:38
Populate notification DB N times

How to

❯ git clone git@github.com:RedHatInsights/ccx-notification-writer.git
❯ cd ccx-notification-writer
❯ make build
❯ ./ccx-notification-writer db-init
❯ cd ..
❯ export PGPASSWORD=postgres
❯ psql --username=postgres --host=localhost --port=5432 --dbname notification -f init.sql; done
@juandspy
juandspy / docker-compose.yml
Last active May 23, 2023 07:03
External data pipeline local setup
version: "3"
services:
# Auxiliar services the external data pipeline needs
db:
ports:
- 5432:5432
image: registry.redhat.io/rhscl/postgresql-13-rhel7
environment:
- POSTGRESQL_USER=user
- POSTGRESQL_PASSWORD=password
@juandspy
juandspy / oc-utils.sh
Created November 5, 2021 07:55
OpenShift useful commands
# Delete cronjob history
oc delete jobs -l parent=$CRONJOB_NAME