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 / smerge_cheatsheet.txt
Last active October 22, 2024 21:46
sublime merge / text cheat sheet
# visual diff using smerge
smerge mergetool file1 file2
# fish open files with wildcard name substiution
smerge mergetool (ls *-myfiles.txt | string split " ")
# bash open files with wildcard name substiution
smerge mergetool $(ls *-myfiles.txt)
@henri
henri / socat_cheat_sheet.bash
Last active November 27, 2023 02:37
socat cheat sheet
# this example sets up a tunnel on the remote system on port 8090 to the system initiating the ssh connection on port 8080
#
# starting socat ipv4 tunnel between ports on remote system (forking and lock file enabled with socat)
# and killing socat with control-c / tunnel close
#
# tags : proxy port
# most direct approach
ssh -t [email protected] -R 8080:127.0.0.1:8080 "socat -L/tmp/socat.lock tcp4-listen:8090,reuseaddr,fork tcp:localhost:8080"
@henri
henri / systemctl_cheat_sheet.txt
Last active May 2, 2025 20:00
systemd cheat sheets
# reload the systemd deamon config files (useful for testing once you have made a change)
systemctl daemon-reload
# list all unit configuration files found in the search paths.
systemctl list-unit-files
# list units with descriptions which are currently loaded into memory
systemctl list-units
# lists units with additional information
@henri
henri / su_cheat_sheet.txt
Last active February 6, 2024 23:57
sudo / su cheat sheet
# login as a user if they do not have a shell :
su - <user> -s /bin/bash
# example logging in as www-data :
su - www-data -s /bin/bash
# add user to sudo group
usermod -aG sudo <user-to-grant-sudo-access>
@henri
henri / sxhkdrc-control-based
Last active August 15, 2023 01:05
LINUX sxhkd + xdotool (control arrorw key press modifications)
# Requires 'sxhkd' and 'xdotool' to both be installed.
# Start 'sxhkd' for this to actually become active
# Config should be installed into this file :
# ./config/sxhkd/sxhkdrc
#
# Released under the GNU/GPL v3 or later :
# https://en.wikipedia.org/wiki/GNU_General_Public_License
#
# Unintended operation and unexpected issues are not my responsobility
# use this script and settings and these tools at your own risk
@henri
henri / macOS_ARD_cheat_sheet.txt
Created July 5, 2023 23:01
ARD on macOS Cheat Sheet
If you are connecting via VNC / ARD client to a macOS system with mutliple GUI sessions.
If the screen saver is enabled on the account and it locks the screen, any subsequent connections will be in
a stuck state, you will not be able to type or even access the screen saver password dialog box. It is like the system
will not recognise any movement.
Provided you have SSH accesss to an admin account on the system and you have no unsaved changes,
you will be able to force logout the GUI enviroment using the command below :
$ sudo launchctl bootout gui/$(id -u <usercode>)
git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "[email protected]"
git config --global credential.helper cache
@henri
henri / bluetooth_auto_connect_toggle.bash
Last active February 19, 2024 01:01
bluetooth disable auto connect
#!/usr/bin/env bash
#
# toggle auto aconnect
# Henri Shustak 2023
# Released under under MIT Licence
# version 1.1 - initial release
# version 1.2 - will work no matter the state of the lock files
toggle_file=/tmp/bluetooth_connect.toogle
@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