Skip to content

Instantly share code, notes, and snippets.

@githubfoam
githubfoam / SELinux cheat sheet
Last active August 12, 2021 23:05
SELinux cheat sheet
$ rpm -qa | grep selinux
libselinux-2.5-11.el7.x86_64
libselinux-python-2.5-11.el7.x86_64
selinux-policy-targeted-3.13.1-166.el7_4.9.noarch
libselinux-utils-2.5-11.el7.x86_64
selinux-policy-3.13.1-166.el7_4.9.noarch
yum install policycoreutils policycoreutils-python selinux-policy selinux-policy-targeted libselinux-utils setroubleshoot-server setools setools-console mcstrans
$ getenforce
@githubfoam
githubfoam / Dockerfile cheat sheet
Last active January 20, 2026 00:13
Dockerfile cheat sheet
#=====================================================================
To Apply the Cron Job in Docker:
1️⃣ Edit the cron file:
echo "10 * * * * root ansible-playbook -i /ansible/inventory-switches.ini /ansible/switch-version.yml >> /var/log/ansible-cron.log 2>&1" > /etc/cron.d/ansible-cron
2️⃣ Set permissions and reload cron:
chmod 0644 /etc/cron.d/ansible-cron
@githubfoam
githubfoam / test-kitchen cheat sheet
Last active December 30, 2018 21:37
test-kitchen cheat sheet
#1st method Install bundler,ruby,rbenv
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update -y
sudo apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev
sudo apt-get install -y libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
@githubfoam
githubfoam / kubernetes cheat sheet
Last active August 26, 2022 13:45
kubernetes cheat sheet
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#CIS_Kubernetes_V1.20_Benchmark_v1.0.0_PDF
#1.1.1 Ensure that the API server pod specification file permissions are set to 644 or more restrictive
Audit:
controlplane $ stat -c %a /etc/kubernetes/manifests/kube-apiserver.yaml
600
controlplane $ ls -lai /etc/kubernetes/manifests/kube-apiserver.yaml
788143 -rw------- 1 root root 3219 Feb 3 06:52 /etc/kubernetes/manifests/kube-apiserver.yaml
@githubfoam
githubfoam / opensuse experience
Last active May 22, 2018 10:49
opensuse experience
zypper se --installed-only -> list all packages
zypper se -si virtualbox vbox kernel
sudo zypper pa -i --installed-only | grep nginx ->#check whether or not nginx is installed
zypper search mpv
zypper remove mpv -> remove package
zypper info cdcat
zypper info --requires cdcat
@githubfoam
githubfoam / freebsd cheat sheet
Last active February 28, 2019 12:33
freebsd cheat sheet
$ freebsd-version -k
11.1-RELEASE-p9
pkg update -y
pkg upgrade -y
pkg install -y wget bmake
Display the network traffic going through active interfaces on the system.
$ systat -ifstat
The iostat utility displays kernel I/O statistics on terminal, device and cpu operations.
@githubfoam
githubfoam / iSER - iscsi Cheat Sheet
Last active October 14, 2022 14:09
iSER - iscsi Cheat Sheet
--------------------------------------------------------------------------
iscsi troubleshooting
--------------------------------------------------------------------------
View discovered targets
# iscsiadm -m node
12.212.84.7:3260,1 iqn.tgt-1
Identify the target transport is configured as iSER
# iscsiadm -m node -T iqn.tgt-1 | grep -i trans
iface.transport_name = iser
@githubfoam
githubfoam / centos, centos stream, fedora experience
Last active September 11, 2025 06:09
centos, centos stream, fedora experience
--------------------------------------------------------------------------------------------------------------------
you are root and you allow existing user to connect passwordless
passwordless ssh
sudo su - alice
mkdir -p ~/.ssh && chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys # paste the single public-key line, save/exit
chmod 600 ~/.ssh/authorized_keys
exit
@githubfoam
githubfoam / Mellanox OFED cheat sheet
Last active May 15, 2026 20:40
Mellanox OFED cheat sheet
--------------------------------------------------------------------------
# ofed_info -s
--------------------------------------------------------------------------
Find Mellanox Adapter Type and Firmware/Driver version
ConnectX-4 card
# lspci | grep Mellanox
0a:00.0 Network controller: Mellanox Technologies MT27500 Family [ConnectX-3]
# lspci -vv -s 0a:00.0 | grep "Part number" -A 3
# lspci | grep Mellanox | awk '{print $1}' | xargs -i -r mstvpd {}
@githubfoam
githubfoam / ubuntu debian experience
Last active September 30, 2025 07:06
ubuntu experience
----------------------------------------------------------------------------------------------------
#shortcuts ubuntu desktop mate
type to search - keyboard shortcuts
ctrl+alt+d minimize/maximize all windows
alt+F9 - minimize windows
ctrl+alt+l - lock screen
--------------------------------------------------------------------------------------------------------------------
#vmware workstation user authentication easy install bug, skip it
--------------------------------------------------------------------------------------------------------------------