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 / Stage-01.sh
Last active August 22, 2019 04:17
Building RPM out of the Git repository inspec-cis-profile in Bamboo
#!/bin/bash
echo 'Cleaning up the working directories...'
rm -rvf ${bamboo.build.working.directory}/*
rm -rvf ~/*
echo 'Installing required software...'
yum -y install rpm-build git
echo 'Checking versions of the required software...'
@luckylittle
luckylittle / DO425.md
Last active January 10, 2025 19:46
Red Hat DO425 Notes

Red Hat Security: Securing Containers & OpenShift (DO425)

Last update: Tue Jan 14 23:15:49 UTC 2020 by @luckylittle


Objectives

  1. Understand, identify, and work with containerization features
  2. Deploy a preconfigured application and identify crucial features such as namespaces, SELinux labels, and cgroups
@luckylittle
luckylittle / RH415.md
Last active June 16, 2025 18:06
Red Hat RH415 Notes

Red Hat Security: Linux in Physical, Virtual and Cloud (RH415)

Last update: Mon Nov 18 05:32:46 UTC 2019 by @luckylittle


1. Managing Security & Risk

# USING YUM TO MANAGE SECURITY ERRATA:
@luckylittle
luckylittle / convert_all_mp4_to_mkv.sh
Created July 3, 2019 04:00
Convert all MP4s in a folder to MKVs using MKVMerge
#!/bin/bash
# Requires: mkvmerge
for RH in *; do mkvmerge ${RH} -o $(basename -s .mp4 ${RH}).mkv; done; echo 'Done!'
# rm *.mp4
@luckylittle
luckylittle / add_remove_extensions.sh
Last active June 28, 2019 11:39
Add / Remove extension to multiple files in Linux
#!/bin/bash
# ls -1
# Dark.Money.2018.DVDRip.x264-WiDE
# Golden.State.Killer.Main.Suspect.2018.INTERNAL.WEB.x264-UNDERBELLY
# Shazam.2019.BDRip.x264-SPARKS
# The.Best.of.Enemies.2019.BDRip.x264-DRONES
# The.Kindergarten.Teacher.2018.BDRip.X264-AMIABLE
# ADD EXTENSION:
@luckylittle
luckylittle / stress_test.py
Last active June 25, 2019 23:07
Memory & CPU Stress Test in Python3
#!/usr/bin/env python
# MIT License
# Copyright (c) 2019 Lucian Maly, <[email protected]>
# Tested on Python v3.7.3 (default, Jun 14 2019, 13:46:58) and Python v2.7.5 (default, Mar 26 2019, 22:13:06)
# Usage: stress_test.py <AMOUNT_OF_MEMORY_YOU_WANT_TO_CONSUME_IN_GB>
# Example: /usr/local/bin/python3.7 stress_test.py 10
# -------------------------
# Filling up 10GB of memory...
# Running load on CPUs...
@luckylittle
luckylittle / listings-setup.tex
Last active July 29, 2023 06:12
LaTeX Code Listings example
% Contents of listings-setup.tex
% Example: pandoc -f markdown_github --listings -H listings-setup.tex -V geometry:margin=0.3in RH342.md -o RH342.pdf
\usepackage{xcolor}
\lstset{
basicstyle=\ttfamily,
keywordstyle=\color[rgb]{0.13,0.29,0.53}\bfseries,
stringstyle=\color[rgb]{0.31,0.60,0.02},
commentstyle=\color[rgb]{0.56,0.35,0.01}\itshape,
backgroundcolor=\color[RGB]{248,248,248},
@luckylittle
luckylittle / RH342.md
Last active May 31, 2025 07:02
Red Hat RH342 Notes

Red Hat Enterprise Linux Diagnostics & Troubleshooting (RH342)

Last update: Fri Jul 26 08:23:20 UTC 2019 by @luckylittle


1. Troubleshooting principles

2. Generic issues

@luckylittle
luckylittle / YAML.md
Created June 7, 2019 03:37
YAML Multilines - Find the right syntax for your multiline strings

YAML Multiline Strings

Block scalars

Find the right syntax for your YAML multiline strings:

There are two types of formats that YAML supports for strings: block scalar and flow scalar formats. (Scalars are what YAML calls basic values like numbers or strings, as opposed to complex types like arrays or objects.) Block scalars have more control over how they are interpreted, whereas flow scalars have more limited escaping support.

  1. Block Style Indicator: The block style indicates how newlines inside the block should behave. If you would like them to be kept as newlines, use the literal style, indicated by a pipe (|). If instead you want them to be replaced by spaces, use the folded style, indicated by a right angle bracket (>). (To get a newline using the folded style, leave a blank line by putting two newlines in. Lines with extra indentation are also not folded.)
@luckylittle
luckylittle / replace.yml
Last active March 14, 2019 08:39
Closing the JSON properly in Ansible (replace last comma with curly braces)
# Sometimes there are moments, when you construct JSON in a really dirty way by just appending key/value pairs and adding comma at the end.
# You will end up with something like this:
# {
# "big_key": {
# "small_key1": "small_value1",
# "small_key2": "small_value2",
# "small_key3": "small_value3",
# And then to make this valid JSON, you need to replace the last comma with curly braces.