Skip to content

Instantly share code, notes, and snippets.

View luckylittle's full-sized avatar
:octocat:
Working for @RedHatOfficial

Lucian Maly luckylittle

:octocat:
Working for @RedHatOfficial
View GitHub Profile
@luckylittle
luckylittle / cca.py
Created December 6, 2021 23:42
Configuration change auditing in Github
from github import Github
from tabulate import tabulate
from datetime import datetime
"""
This script produces table with all merged pull requests within a certain time period. It is useful for configuration change auditing.
"""
github_token = ''
github_api_url = 'https://githubenterprise.service.com/api/v3'
@luckylittle
luckylittle / skopeo-mirror-images.sh
Created December 6, 2021 23:28
Skopeo mirroring & flattening script
#!/bin/zsh
DESTINATION=dtrqa.docker.service.com
NAMESPACE=enablement
copy_to_reg () {
echo ------------------------------------------
echo Copying $2 from $1 to Internal Registry...
skopeo --insecure-policy copy --dest-tls-verify=false docker://$1/$2 docker://${DESTINATION}/${NAMESPACE}/${2##[a-z]*/}
@luckylittle
luckylittle / gist:080a36dfa541eaa0ec6ae5999a5ddfa3
Last active June 19, 2022 03:45
Fedora Linux 35 WiFi6 Speed Problem
Intel Wifi 6 AX200 speed problems. Fix:
1.
/etc/modprobe.d/iwlmvm.conf
options iwlmvm power_scheme=1
2.
/etc/modprobe.d/iwlwifi.conf
@luckylittle
luckylittle / convert_m4a2mp3.sh
Created October 27, 2021 07:35
Convert all M4A to MP3 using ffmpeg
#!/bin/zsh
find . -type f -name '*.m4a' -execdir /bin/zsh -c '/usr/bin/ffmpeg -i $0 -c:v copy -c:a libmp3lame -q:a 4 ${0/m4a/mp3}' {} \;
@luckylittle
luckylittle / Beep.b64
Created October 2, 2021 22:20
Beep sound in WAV format, Base64 encoded
UklGRuBXBwBXQVZFZm10IBAAAAABAAEAgLsAAAB3AQACABAAZGF0YVpUBwCx/5T/O/9P/3j/mP90
/3b/ZP9G/zL/R/9S/4z/n/+4/7n/tf+d/yH/dv6i/e38avwp/B79KP/zAPcAs//E/tX+Lf+e/7wA
EwOKBtwIFQnCBxkI4AksDToPBREREb8N0gWe9TLqouln9IT9H/zg9ZH11PJZ7ozkHds95EXziv8a
93/yA/R990f5j/mgCmcdfCMoHL0USxYXFr4LGPVb9B8AIQjG/U/4WQFpCsMAjPMy8QUFrBXBFM0L
BA1PEf0SSQRL+mAA1Q2eEpEQZQ3EBxf2G+GZ2ezp0Ph7+sPwmu5F6YXfjMpKwfLNPOpn8pDooujU
7if6AP3dB9glAjgwO88uHC/NNF8yrRsnDbYTsR5rFvj8y/M++r76o+4B42ro0gKDDmcHZf8R/7D/
UvlE6JrrmfyCC6AMyQroCzMIZ/a95bTuMAYOD4ME7vhP9sXw999jxsbBMNci8GPos+HJ4ebq6PRL
+U4PBCl1MKorWCRdK2su9CNVC/4LTRntJm0ZwQoQBq4I+/+f9XDt1/3iEVIXUQ+rB078evHO3uLY
ieZG9XP8XgG6CMcUcxAu/gbqVOgi7zD41vqU/ef6tfWO7dbZGs9AzSDVgeen+0f+A/Ma9kb6fgdz
BZEMKyHENE4/VDiEM8gwvCuNGrwScRiPGeYJN/ed9igAR/gV6j7llvcyDEYHvey739vkYvZb+Jvr
@luckylittle
luckylittle / HashiCorp_Vault_Associate_(exam_notes).md
Last active January 6, 2025 19:12
HashiCorp Vault Associate (exam notes)

HashiCorp Vault Associate (exam notes)

Exam objectives

Exam Objectives
1 Compare authentication methods
  1a Describe authentication methods
  1b Choose an authentication method based on use case
  1c Differentiate human vs. system auth methods
@luckylittle
luckylittle / README.md
Created May 5, 2021 04:02
README.md template
@luckylittle
luckylittle / ocp4_all_resources.md
Created March 12, 2021 01:48
How can I list all resources and custom resources in OpenShift 4

How can I list all resources and custom resources in OpenShift

List all CRDs with CR name and Scope

oc get crd -o=custom-columns=NAME:.metadata.name,CR_NAME:.spec.names.singular,SCOPE:.spec.scope

List every single custom resources in the cluster

oc get $(oc get crd -o=custom-columns=CR_NAME:.spec.names.singular --no-headers | awk '{printf "%s%s",sep,$0; sep=","}') --ignore-not-found --all-namespaces -o=custom-columns=KIND:.kind,NAME:.metadata.name,NAMESPACE:.metadata.namespace

List every single resource in the cluster (custom and non-custom)

oc get $(oc api-resources --verbs=list -o name | awk '{printf "%s%s",sep,$0;sep=","}') --ignore-not-found --all-namespaces -o=custom-columns=KIND:.kind,NAME:.metadata.name,NAMESPACE:.metadata.namespace --sort-by='metadata.namespace'

@luckylittle
luckylittle / registry_access.sh
Created March 11, 2021 03:39
Access to OpenShift Image Registry via ServiceAccount token
#!/bin/bash
# Confirm the service is up:
oc get svc image-registry -n openshift-image-registry
# Create a ServiceAccount:
oc create sa pipeline
# Add image-builder role to the ServiceAccount:
oc adm policy add-role-to-user system:image-builder -z pipeline
# Add privileged Security Context Constraint (SCC) so you can run container inside container:
oc adm policy add-scc-to-user privileged -z pipeline
@luckylittle
luckylittle / check_etcd.sh
Created February 22, 2021 01:32 — forked from pichuang/check_etcd.sh
Check etcd status on OCP 4.6.1
#!/bin/bash
# Ref: https://docs.openshift.com/container-platform/4.6/backup_and_restore/backing-up-etcd.html
etcd_node=`oc get pods -n openshift-etcd -l app=etcd -o=jsonpath='{.items[0].spec.nodeName}'`
ssh -i ~/.ssh/dmz-ocp4-rsa core@$etcd_node
id=$(sudo crictl ps --name etcdctl | awk 'FNR==2{ print $1}') && sudo crictl exec -it $id /bin/bash
etcdctl member list -w table
etcdctl endpoint health --cluster