Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / 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 / sql cheat sheet
Created December 18, 2019 21:45
sql cheat sheet
# mysql
$ sudo mysql -u root -p
mysql>create database spacedb;
mysql>create user 'cosmo'@'localhost' identified by 'password';
mysql>GRANT ALL PRIVILEGES ON spacedb.* TO 'cosmo'@'localhost';
$ mysql -u cosmo -p
mysql> use spacedb;
CREATE TABLE IF NOT EXISTS city(
id int(11) NULL,
@githubfoam
githubfoam / network automation
Created October 4, 2019 17:27
network automation
sudo grep -v '^#' simplelist.txt | awk -F, '{printf("%s:\n device_type:%s\n ip: %s\n username:netadmin\n password:secretpass\n port:22\n",$1,$2,$1)}' | sudo tee netmiko.yml
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
https://www.wireshark.org/docs/dfref/ #Display Filter Reference
-----------------------------------------------------------1-----------------------------------------------1-------------------------------------------------------------------------
#Bing
Step-by-step instructions to decrypt TLS traffic from Chrome or Firefox in Wireshark:
https://wiki.wireshark.org/TLS.
How to decrypt TLS traffic in Wireshark
https://www.packetsafari.com/blog/2022/10/07/wireshark-decryption/