Skip to content

Instantly share code, notes, and snippets.

View henri's full-sized avatar
💭
hacking the mainframe

henri henri

💭
hacking the mainframe
View GitHub Profile
@henri
henri / virsh_cheatsheet.txt
Created May 2, 2023 01:18
virsh cheatsheet (kvm/qemu/vm/virtual)
# set a domain to auto start
virsh autostart <machine/domain>
# show all domains set to autostart
virsh list --all --autostart
# show all domains not set to autostart
virsh list --all --no-autostart
@henri
henri / lsof_cheat_sheet.txt
Last active April 24, 2023 04:59
lsof cheat sheet
# show open TCP ports which are listening on the host
sudo lsof -nP -iTCP -sTCP:LISTEN
@henri
henri / .tmux.conf
Last active March 7, 2025 10:22
tmux cheatsheet
# sorce in other config files
# source-file ~/.conf/tmux/tmux_reset.conf
# bind alt arrorw keys for switching panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# start window number at 1 rather than zero (good if you do not have a numpad on your keyboard)
@henri
henri / wiregaurd-cheat-sheet.txt
Last active July 10, 2024 03:24
wiregaurd cheatsheet
# basic status information
wg show
# enable wiregaurd unit (interface wg0) with systemctl
sudo systemctl enable --now wg-quick@wg0
# disable wiregaurd unit (interface wg0) with systemctl
sudo systemctl disable --now wg-quick@wg0
# bring up wireguard (interface wg0)
@henri
henri / fish_config_cheat_sheet.txt
Last active March 25, 2025 23:32
fish_config_cheat_sheet
# Edits you can make to ~/.config/fish/config.fish
# do not compress the PWD readout
set fish_prompt_pwd_dir_length 0
# remove the fish greeting or set it to something else
@henri
henri / gist:e10b60c467432f884ef0632ce865a2a2
Last active January 22, 2023 23:04
disk_space_email_alert.bash
#!/bin/bash
# requires sendEmail to be installed.
SYSTEM_NAME="hostname"
FROM_EMAIL="[email protected]"
TO_EMAIL="[email protected] [email protected]"
SMTP_SERVER_NAME="smtp.com:587"
SMTP_USER_NAME="smtp__user_name"
SMTP_PASS="smtp_password"
@henri
henri / apt_cheat_sheet.txt
Last active May 4, 2025 22:32
apt cheat sheet
### APT Tips (tested only on Ubuntu)
##
## Problem :
## The following packages have been kept back
##
## Possible Solutions (depending on the situation) :
# non-manual upgrade of kept back packages (safest) :
sudo apt-get --with-new-pkgs upgrade
sudo apt-get --with-new-pkgs upgrade <list of packages kept back>
@henri
henri / 001.awk_cheatsheet.txt
Last active February 4, 2025 01:11
AWK Cheatsheet
# How to just buffer each line (rather than the entire input stream) when using awk / gawk to read data from a pipe.
awk '{ print $0 ; system("") }' # compatible with POSIX complient systems
gawk '{ print $0 ; system("") }' # gawk is smart and will not actually start a sub-shell
# fflush - is going to offer something similar (although you can speicify which kind of output you would like to flush).
@henri
henri / clear_arp_cache.bash
Created October 31, 2022 22:46
MacOS Clear ARP Cache Script
#!/bin/bash
# This script is used to clear the arp cache on macOS - it may even work on other operating systems
# (C)2005 Henri Shustak
# Released Under MIT Licence : http://mit-license.org
# check we are running as root
currentUser=`whoami`
if [ $currentUser != "root" ] ; then
echo This script must be run with super user privileges
@henri
henri / macOS flush dns cache
Created October 20, 2022 22:38
Flush DNS cache on macOS system
# macOS 10.15 and later
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder