Skip to content

Instantly share code, notes, and snippets.

@githubfoam
githubfoam / puppet cheat sheet
Last active August 12, 2021 23:05
puppet cheat sheet
-----------------------------------------------------------------------------------------------------
#Debian
sudo apt-get install puppet -y
#RedHat
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
yes | sudo yum install puppet
ls -l /etc/puppet
facter | grep hostname
-----------------------------------------------------------------------------------------------------
@githubfoam
githubfoam / git forensics audit
Last active October 6, 2021 10:39
git forensics audit
--------------------------------------------------------------------------------------------------------------------------
$ git clone https://kevzettler@bitbucket.org/kevzettler/git-blame-example.git && cd git-blame-example
$ git log
$ git blame README.md
$ git blame -L 1,5 README.md
$ git blame -e README.md
# list all original commits in-which a specific code piece was added or modified execute
$ git log -S"This repository is an example of a project" --pretty=format:'%h %an %ad %s'
@githubfoam
githubfoam / sed cheat sheet
Last active September 11, 2025 06:18
sed cheat sheet
------------------------------------------------------------------------------------------
curl -I -sS http://localhost:7777 | sed -n '1,6p'
curl → makes a request to the given URL.
-I → fetches only the HTTP headers (HEAD request instead of GET).
-sS → silent mode (hides progress bar), but still shows errors if they occur.
http://localhost:7777 → target URL (your web server running on port 7777).
@githubfoam
githubfoam / freebsd cheat sheet
Last active September 8, 2025 13:16
freebsd cheat sheet
=============================================================================================
Additional Checks for Windows 11:
Virtualization Enabled: Ensure VT-x/AMD-V is enabled in BIOS/UEFI.
Enable GUI temporarily for visual debugging:
In the Vagrantfile, change vb.gui = false to vb.gui = true to see what's happening during boot
@githubfoam
githubfoam / openBSD cheat sheet
Created December 27, 2019 14:56
openBSD cheat sheet
=============================================================================================
openBSD
add repo url
echo 'https://cdn.openbsd.org/pub/OpenBSD' > /etc/installurl
$ doas pkg_add -xz python-2.7 ansible py-psycopg2
$ ansible --version
ansible 2.8.5
$ doas pkg_add git
@githubfoam
githubfoam / cuda cheat sheet
Created December 30, 2019 23:28
cuda cheat sheet
#check if pytorch is using the GPU
python -c 'import torch; print(torch.cuda.is_available())' #should print True
python -c 'import torch; print(torch.rand(2,3).cuda())'
watch -n 2 nvidia-smi
=========================================================================
import torch
dev = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
@githubfoam
githubfoam / archlinux experience
Created January 9, 2020 17:30
archlinux experience
/var/log/pacman.log
sudo pacman -Syu --noconfirm #Update and upgrade all packages on the system
pacman -Sc #Clean package cache
sudo pacman -Syy #Update package list
pacman -Qe #List explictly-installed packages
pacman -Qdt #List unneeded packages
pacman -Rns $(pacman -Qdtq) #Uninstall unneeded packages
@githubfoam
githubfoam / solaris 11-4 cheat sheet
Created February 25, 2020 16:53
solaris 11-4 cheat sheet
#pkg update
# System configuration profiles are processed by SMF after OS package installation when a client first boots.
#The Service Management Facility in Oracle Solaris 11 is used to configure systems and store related configuration data, allowing changes to persist across system updates.
sysconfig create-profile -o profile.xml
sysconfig configure -c sc-profile.xml #The resulting profile can be used with AI or as input to a sysconfig command
kstat -p | grep link_ | grep bge # display network interface variables
#vagrant sudoer
@githubfoam
githubfoam / minikube
Last active July 21, 2022 13:13
minikube
------------------------------------------------------------------------------------------------
sudo -E minikube start --driver=none --kubernetes-version v1.11.8 --extra-config kubeadm.ignore-preflight-errors=SystemVerification #Some versions of Linux have a version of docker that is newer than what Kubernetes expects. To overwrite this, run minikube with the following parameters
sudo minikube config set driver none #make none the default driver
minikube start --alsologtostderr -v=4 #debug crashes
sudo minikube start --profile=minikube --memory=8192 --cpus=4 --vm-driver=none --kubernetes-version=v$KUBERNETES_VERSION # The 'none' driver does not respect the --cpus flag ! The 'none' driver does not respect the --memory flag
sudo minikube start --memory=8192 --cpus=4 --vm-driver="virtualbox"
------------------------------------------------------------------------------------------------
kubectl config use-context minikube #use kubectl to switch to the minikube context, so we can talk to the cluster
-----------
@githubfoam
githubfoam / macos_administrator_daily_tasks
Last active March 31, 2022 08:11
macos_administrator_daily_tasks
--------------------------------------------------------------------------------------------------------------------------------------------------
#zsh shell (Z-Shell),Most versions of macOS ship with zsh pre-installed
zsh --version
chsh -s $(which zsh) #set zsh as the default shell
chsh -s $(which bash) # revert to Bash
chsh -s /usr/local/bin/zsh
chsh -s /bin/zsh
--------------------------------------------------------------------------------------------------------------------------------------------------
#Hosts File
Windows 10 - "C:\Windows\System32\drivers\etc\hosts"