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 / maxload.bash
Last active March 15, 2024 02:51
mximum load factor reporting script
#!/usr/bin/bash
# Simple Script which prints the maximum load factor to stdout.
# Henri Shustak (C) 2023
# Released Under GNU GPL v3 or later
# version 1.0 initial release.
# version 2.0 bug fix which resulted in different load factor being reported.
# version 3.0 added date to output
# version 4.0 added an optional reset paramater
# version 4.1 bug fix regarding reset time
@henri
henri / x11vnc_cheatsheet.txt
Last active May 3, 2023 07:37
x11vnc cheat sheet
# auto detect password and xsession authority IPv4 local host and keep running after disconnect (-forever).
x11vnc -noipv6 -forever -listen 127.0.0.1 -usepw -find
# set a password (default location - ~/.vnc/passwd)
x11vnc -storepasswd
@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 April 29, 2024 06:52
tmux cheatsheet
# 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)
set -g base-index 1
# allow different clients to have different sized windows (same session)
@henri
henri / wiregaurd-cheat-sheet.txt
Last active February 10, 2024 07:48
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 28, 2024 04:47
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
set -U fish_greeting ""
@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="from@email.com"
TO_EMAIL="dest1@email.com dest2@email.com"
SMTP_SERVER_NAME="smtp.com:587"
SMTP_USER_NAME="smtp__user_name"
SMTP_PASS="smtp_password"
@henri
henri / apt_cheat_sheet.txt
Last active April 22, 2024 22:34
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 / awk_cheatsheet.txt
Last active November 1, 2022 03:24
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).