Skip to content

Instantly share code, notes, and snippets.

View kcsinclair's full-sized avatar

Keith Sinclair kcsinclair

View GitHub Profile
@kcsinclair
kcsinclair / gist:c46313a396891b967bb1431dfcfaaeaa
Created October 26, 2023 02:24
Check Swap Memory which processes are using swap
# simple effective works.
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n
@kcsinclair
kcsinclair / ssh-config
Created September 21, 2023 01:31
Useful SSH feature configuration for ~/.ssh/config
# file is typically /home/username/.ssh/config or ~/.ssh/config
# Enable SSH connection multiplexing.
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
# default settings for all hosts
Host *
AddKeysToAgent yes
UseKeychain yes
@kcsinclair
kcsinclair / date-commands.sh
Created September 6, 2023 03:34
Using Linux date to convert dates and handle epoch times
# Display current time in Unix epoch (seconds since 1970-01-01 UTC).
date +%s
# Display a specific time in Unix epoch.
date --date="1 Jan 2000" +%s
#Convert seconds since the epoch (1970-01-01 UTC) to a date
date --date='@2147483647'
@kcsinclair
kcsinclair / mac-unlock-files.sh
Last active September 6, 2023 03:35
Unlock all files and folders on Apple MAC
# https://discussions.apple.com/thread/3416597
chflags -R nouchg /path/to/directory