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 / pre-commit.sh
Created February 15, 2023 04:41
Pre-commit Git hook (.git/hooks/pre-commit.sh) that checks certain keywords
#!/bin/sh
matches=$(git diff-index --patch HEAD | grep '^+' | grep -Pi 'password|keyword2|keyword3')
if [ ! -z "$matches" ]
then
cat <<\EOT
Error: Words from the blocked list were present in the diff:
EOT
echo $matches
exit 1
fi
@luckylittle
luckylittle / Mock Exam 1.md
Last active January 16, 2026 19:18
Prometheus Certified Associate (PCA)

Mock Exam

1

Q1. The metric node_cpu_temp_celcius reports the current temperature of a nodes CPU in celsius. What query will return the average temperature across all CPUs on a per node basis? The query should return {instance=“node1”} 23.5 //average temp across all CPUs on node1 {instance=“node2”} 33.5 //average temp across all CPUs on node2.

node_cpu_temp_celsius{instance="node1", cpu="0"} 28
node_cpu_temp_celsius{instance="node1", cpu="1"} 19
node_cpu_temp_celsius{instance="node2", cpu="0"} 36
node_cpu_temp_celsius{instance="node2", cpu="1"} 31
@luckylittle
luckylittle / CC.md
Last active December 11, 2023 15:12
(ISC)2 Flashcards for CC (Certified in Cybersecurity)
  1. Security commensurate with the risk and the magnitude of harm resulting from the loss, misuse or unauthorized access to or modification of information.

Adequate Security

  1. Controls implemented through policy and procedures. Examples include access control processes and requiring multiple personnel to conduct a specific operation. Administrative controls in modern environments are often enforced in conjunction with physical and/or technical controls, such as an access-granting policy for new users that requires login and approval by the hiring manager.

Administrative Controls

  1. The ability of computers and robots to simulate human intelligence and behavior. > Artificial Intelligence
@luckylittle
luckylittle / mkdir.sh
Created September 15, 2022 23:06
How to read complete line in `for` loop with spaces
IFS=$'\n'; for course in $(cat mkdir.txt); do mkdir ${course}; done; unset IFS
@luckylittle
luckylittle / radarr-unmonitor-downloaded.py
Created August 28, 2022 10:58
Python script to unmonitor already grabbed movies from Radarr v4.1.0.6175
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
import json
import requests
import sys
import datetime
APIKEY=''
URL='http://localhost:7878/api/v3'
@luckylittle
luckylittle / .tmux.conf
Last active October 7, 2023 16:42
Ultimate tmux.conf files
source ~/.tmux/.tmux.conf
source ~/.tmux/.tmux.conf.ui
@luckylittle
luckylittle / playbook-export.yml
Created July 29, 2022 05:36
Complete backup of Red Hat Ansible Automation Platform into YAML files ready to be used by redhat_cop.controller_configuration collection
---
- name: Playbook to Export all resources from the AAP into YAML files using awxkit
hosts: localhost
vars:
controller_configuration_path: "/home/lmaly/Projects/awxkit"
tasks:
- name: Export all users assets
awx.awx.export:
users: 'all'
register: "users"
@luckylittle
luckylittle / clean_logs_rhel.sh
Created June 20, 2022 06:00
Quickly empty all the major logs on RHEL
#!/bin/zsh
LOGS=(
/var/log/boot.log
/var/log/btmp
/var/log/cron
/var/log/dnf.librepo.log
/var/log/dnf.log
/var/log/dnf.rpm.log
/var/log/firewalld
@luckylittle
luckylittle / at_1640_stop_move_mouse.sh
Last active January 4, 2023 09:52
Move mouse for Linux Wayland (EVEMU)
#!/bin/zsh
at 16:40 <<END
pgrep evemu | xargs sudo kill -9
pgrep tiny_move_mouse | xargs sudo kill -9
END
@luckylittle
luckylittle / officeworks.py
Last active December 29, 2023 07:07
Officeworks price checker
import datetime
import smtplib
import time
import requests
import sys
import random
import json
from bs4 import BeautifulSoup
# chmod x officeworks.py