This commit is contained in:
David Tomaschik
2026-04-21 15:59:38 -07:00
parent fec16225e4
commit db2c02bd2d
27 changed files with 150 additions and 55 deletions

View File

@@ -12,8 +12,17 @@ fi
trap "test -f ${FILENAME} && rm -f ${FILENAME}" EXIT trap "test -f ${FILENAME} && rm -f ${FILENAME}" EXIT
IOENGINE="libaio"
DIRECT=1
if [ "$(uname)" = "Darwin" ]; then
IOENGINE="posixaio"
# macOS doesn't support O_DIRECT in the same way, but fio's direct=1
# handles it via F_NOCACHE if supported.
DIRECT=1
fi
fio --loops=5 --size=${BENCHMARK_SIZE} --filename=${FILENAME} \ fio --loops=5 --size=${BENCHMARK_SIZE} --filename=${FILENAME} \
--stonewall --ioengine=libaio --direct=1 \ --stonewall --ioengine=${IOENGINE} --direct=${DIRECT} \
--name=Seqread --bs=1m --rw=read \ --name=Seqread --bs=1m --rw=read \
--name=Seqwrite --bs=1m --rw=write \ --name=Seqwrite --bs=1m --rw=write \
--name=512Kread --bs=512k --rw=randread \ --name=512Kread --bs=512k --rw=randread \

View File

@@ -1,6 +1,10 @@
#!/bin/bash #!/bin/bash
CHROME_BINS="google-chrome-beta google-chrome" CHROME_BINS="google-chrome-beta google-chrome"
if [ "$(uname)" = "Darwin" ]; then
CHROME_BINS="${CHROME_BINS} /Applications/Google\ Chrome\ Beta.app/Contents/MacOS/Google\ Chrome\ Beta /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
fi
for bin in ${CHROME_BINS} ; do for bin in ${CHROME_BINS} ; do
if command -v ${bin} >/dev/null 2>&1 ; then if command -v ${bin} >/dev/null 2>&1 ; then
CHROME=$(command -v ${bin}) CHROME=$(command -v ${bin})
@@ -18,4 +22,4 @@ export HOME=${HOME}/.chrome-pentest
mkdir -p ${HOME} mkdir -p ${HOME}
# Launch chrome for burp # Launch chrome for burp
exec ${CHROME} --user-data-dir=${HOME}/chrome-pentest --proxy-server=127.0.0.1:8080 exec "${CHROME}" --user-data-dir=${HOME}/chrome-pentest --proxy-server=127.0.0.1:8080

View File

@@ -5,8 +5,14 @@
set -ue set -ue
TOOLS="flameshot scrot" TOOLS="flameshot scrot"
if [ "$(uname)" = "Darwin" ]; then
TOOLS="screencapture ${TOOLS}"
fi
SCREENDIR=${SCREENDIR:-${HOME}/Pictures/Screenshots} SCREENDIR=${SCREENDIR:-${HOME}/Pictures/Screenshots}
SCROT_FORMAT="%F-%T.png" SCROT_FORMAT="%F-%T.png"
# Filename for screencapture
FILE_NAME=$(date "+%Y-%m-%d-%H%M%S.png")
function default_screenshot_command { function default_screenshot_command {
for tool in ${TOOLS} ; do for tool in ${TOOLS} ; do
@@ -41,10 +47,29 @@ function scrot_full_capture {
scrot "${SCREENDIR}/${SCROT_FORMAT}" scrot "${SCREENDIR}/${SCROT_FORMAT}"
} }
function mac_capture {
local mode="${1}"
local target="${SCREENDIR}/${FILE_NAME}"
case "${mode}" in
region)
screencapture -i "${target}"
;;
window)
screencapture -i -w "${target}"
;;
full)
screencapture "${target}"
;;
esac
}
case "${CMD}" in case "${CMD}" in
region|window|full) region|window|full)
mkdir -p "${SCREENDIR}" mkdir -p "${SCREENDIR}"
case "${TOOL}" in case "${TOOL}" in
screencapture)
mac_capture "${CMD}"
;;
flameshot) flameshot)
case "${CMD}" in case "${CMD}" in
region|window) region|window)

View File

@@ -1,9 +1,6 @@
# General aliases, should only be sourced in interactive shells # General aliases, should only be sourced in interactive shells
# Try to keep in sync with ~/.config/fish/conf.d/aliases.fish # Try to keep in sync with ~/.config/fish/conf.d/aliases.fish
# Cryptsetup alias
alias luksFormat='cryptsetup luksFormat --type=luks2 --pbkdf-memory=2560000 --pbkdf=argon2id -i 15000 -s 512 -h sha256 -c aes-xts-plain64'
# Timestamp in a machine-sortable form # Timestamp in a machine-sortable form
alias tstamp="date '+%Y%m%d-%H%M%S'" alias tstamp="date '+%Y%m%d-%H%M%S'"
@@ -13,12 +10,6 @@ alias mdcode="sed 's/^/ /'"
# Intel format plz # Intel format plz
alias objdump="command objdump -M intel" alias objdump="command objdump -M intel"
# Drop caches for swap issues
alias drop_caches="echo 3 | sudo /usr/bin/tee /proc/sys/vm/drop_caches"
# dump acpi temperature
alias gettemp='printf "%02.2f\n" "$(cat /sys/class/thermal/thermal_zone0/temp)e-3"'
# get git working directory # get git working directory
alias gitroot="git rev-parse --show-toplevel" alias gitroot="git rev-parse --show-toplevel"
@@ -31,20 +22,37 @@ alias ipy="ipython3 --no-banner"
# Skip the header on bc # Skip the header on bc
alias bc="command bc -q" alias bc="command bc -q"
# Get a decently readable df
alias dfh="df -h -x tmpfs -x devtmpfs -x squashfs -x fuse -x efivarfs"
# Clear the GPG agent # Clear the GPG agent
alias clear-gpg-agent="echo RELOADAGENT | gpg-connect-agent" alias clear-gpg-agent="echo RELOADAGENT | gpg-connect-agent"
# Earthly ssh
alias earthly='earthly --ssh-auth-sock ""'
if [ "$(uname)" = "Linux" ]; then
# Cryptsetup alias
alias luksFormat='cryptsetup luksFormat --type=luks2 --pbkdf-memory=2560000 --pbkdf=argon2id -i 15000 -s 512 -h sha256 -c aes-xts-plain64'
# Drop caches for swap issues
alias drop_caches="echo 3 | sudo /usr/bin/tee /proc/sys/vm/drop_caches"
# dump acpi temperature
alias gettemp='printf "%02.2f\n" "$(cat /sys/class/thermal/thermal_zone0/temp)e-3"'
# Get a decently readable df
alias dfh="df -h -x tmpfs -x devtmpfs -x squashfs -x fuse -x efivarfs"
# Battery details # Battery details
alias bat-details='upower -i $(upower -e | grep battery)' alias bat-details='upower -i $(upower -e | grep battery)'
# Nvidia refresh rate # Nvidia refresh rate
alias nvidia-refresh-rate='nvidia-settings --display=:0 -q RefreshRate -t' alias nvidia-refresh-rate='nvidia-settings --display=:0 -q RefreshRate -t'
# Earthly ssh
alias earthly='earthly --ssh-auth-sock ""'
# to clipboard # to clipboard
alias toclip='xclip -selection clipboard' alias toclip='xclip -selection clipboard'
elif [ "$(uname)" = "Darwin" ]; then
# Get a decently readable df
alias dfh="df -h"
# to clipboard
alias toclip='pbcopy'
fi

View File

@@ -1,6 +1,3 @@
# Cryptsetup alias
alias luksFormat 'cryptsetup luksFormat --type=luks2 --pbkdf-memory=2560000 --pbkdf=argon2id -i 15000 -s 512 -h sha256 -c aes-xts-plain64'
# Timestamp in a machine-sortable form # Timestamp in a machine-sortable form
alias tstamp "date '+%Y%m%d-%H%M%S'" alias tstamp "date '+%Y%m%d-%H%M%S'"
@@ -10,12 +7,6 @@ alias mdcode "sed 's/^/ /'"
# Intel format plz # Intel format plz
alias objdump "command objdump -M intel" alias objdump "command objdump -M intel"
# Drop caches for swap issues
alias drop_caches "echo 3 | sudo /usr/bin/tee /proc/sys/vm/drop_caches"
# dump acpi temperature
alias gettemp 'printf "%02.2f\n" (cat /sys/class/thermal/thermal_zone0/temp)e-3'
# get git working directory # get git working directory
alias gitroot "git rev-parse --show-toplevel" alias gitroot "git rev-parse --show-toplevel"
@@ -28,23 +19,40 @@ alias ipy "ipython3 --no-banner"
# Skip the header on bc # Skip the header on bc
alias bc "command bc -q" alias bc "command bc -q"
# Get a decently readable df
alias dfh "df -h -x tmpfs -x devtmpfs -x squashfs -x fuse -x efivarfs"
# Clear the GPG agent # Clear the GPG agent
alias clear-gpg-agent "echo RELOADAGENT | gpg-connect-agent" alias clear-gpg-agent "echo RELOADAGENT | gpg-connect-agent"
# Earthly ssh
alias earthly 'earthly --ssh-auth-sock ""'
if test (uname) = "Linux"
# Cryptsetup alias
alias luksFormat 'cryptsetup luksFormat --type=luks2 --pbkdf-memory=2560000 --pbkdf=argon2id -i 15000 -s 512 -h sha256 -c aes-xts-plain64'
# Drop caches for swap issues
alias drop_caches "echo 3 | sudo /usr/bin/tee /proc/sys/vm/drop_caches"
# dump acpi temperature
alias gettemp 'printf "%02.2f\n" (cat /sys/class/thermal/thermal_zone0/temp)e-3'
# Get a decently readable df
alias dfh "df -h -x tmpfs -x devtmpfs -x squashfs -x fuse -x efivarfs"
# Battery details # Battery details
alias bat-details 'upower -i (upower -e | grep battery)' alias bat-details 'upower -i (upower -e | grep battery)'
# Nvidia refresh rate # Nvidia refresh rate
alias nvidia-refresh-rate 'nvidia-settings --display=:0 -q RefreshRate -t' alias nvidia-refresh-rate 'nvidia-settings --display=:0 -q RefreshRate -t'
# Earthly ssh
alias earthly 'earthly --ssh-auth-sock ""'
# to clipboard # to clipboard
alias toclip 'xclip -selection clipboard' alias toclip 'xclip -selection clipboard'
else if test (uname) = "Darwin"
# Get a decently readable df
alias dfh "df -h"
# to clipboard
alias toclip 'pbcopy'
end
# On some systems, bat is batcat # On some systems, bat is batcat
if not command -v bat >/dev/null 2>&1 if not command -v bat >/dev/null 2>&1

View File

@@ -34,4 +34,6 @@ end
fish_add_path --move --path {$HOME}/bin fish_add_path --move --path {$HOME}/bin
if test (uname) = "Darwin" if test (uname) = "Darwin"
fish_add_path --move --path {$HOME}/bin/macos fish_add_path --move --path {$HOME}/bin/macos
else if test (uname) = "Linux"
fish_add_path --move --path {$HOME}/bin/linux
end end

View File

@@ -194,6 +194,8 @@ if [ "$(uname)" = "Darwin" ] ; then
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-$TMPDIR/runtime-$(id -u)}" export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-$TMPDIR/runtime-$(id -u)}"
export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}" export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
export PATH="${HOME}/bin/macos:${PATH}" export PATH="${HOME}/bin/macos:${PATH}"
elif [ "$(uname)" = "Linux" ] ; then
export PATH="${HOME}/bin/linux:${PATH}"
fi fi
if test -e "$HOME/.localenv"; then if test -e "$HOME/.localenv"; then

View File

@@ -45,7 +45,7 @@ set -g window-status-current-style fg=colour235,bg=colour33,bold
set -g status-interval 60 set -g status-interval 60
set -g status-left-length 30 set -g status-left-length 30
set -g status-left '/#h: #S/ ' set -g status-left '/#h: #S/ '
set -g status-right '#{?pane_title,/#{pane_title}/ ,}#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=colour166]%H:%M#[default]' set -g status-right '#{?pane_title,/#{pane_title}/ ,}#(uptime | rev | cut -d":" -f1 | rev | sed s/,//g)#[default] #[fg=colour166]%H:%M#[default]'
# Advanced mouse mode from http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/ # Advanced mouse mode from http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/
# Toggle mouse on # Toggle mouse on
@@ -65,8 +65,9 @@ bind M \
display 'Mouse: OFF' display 'Mouse: OFF'
# tmux X clipboard integration # tmux X clipboard integration
bind C-c run "tmux show-buffer | xsel -i -b" if-shell 'test "$(uname)" = "Darwin"' \
bind C-v run "tmux set-buffer -- \"$(xsel -o -b)\"; tmux paste-buffer" 'bind C-c run "tmux show-buffer | pbcopy"; bind C-v run "tmux set-buffer -- \"$(pbpaste)\"; tmux paste-buffer"' \
'bind C-c run "tmux show-buffer | xsel -i -b"; bind C-v run "tmux set-buffer -- \"$(xsel -o -b)\"; tmux paste-buffer"'
# List of plugins # List of plugins
set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tpm'

View File

@@ -289,6 +289,8 @@ fi
PATH="${HOME}/bin:${PATH}" PATH="${HOME}/bin:${PATH}"
if [[ "$(uname)" == "Darwin" ]]; then if [[ "$(uname)" == "Darwin" ]]; then
PATH="${HOME}/bin/macos:${PATH}" PATH="${HOME}/bin/macos:${PATH}"
elif [[ "$(uname)" == "Linux" ]]; then
PATH="${HOME}/bin/linux:${PATH}"
fi fi
# Load any local settings # Load any local settings

View File

@@ -18,8 +18,15 @@ alert() {
icon="error" icon="error"
fi fi
if [ "$(uname)" = "Darwin" ]; then
# macOS notification
local title="Finished: '$*'"
local msg="Exit code: $ret"
osascript -e "display notification \"$msg\" with title \"$title\""
else
# Send the notification with the executed command # Send the notification with the executed command
notify-send --urgency=low -i "$icon" "Finished: '$@'" notify-send --urgency=low -i "$icon" "Finished: '$@'"
fi
# Return the original exit code # Return the original exit code
return $ret return $ret

View File

@@ -1,7 +1,12 @@
if [ "$(uname)" = "Darwin" ]; then
ANDROID_HOME=$HOME/Library/Android/sdk ANDROID_HOME=$HOME/Library/Android/sdk
else
ANDROID_HOME=$HOME/Android/Sdk
fi
if test -d $ANDROID_HOME ; then if test -d "${ANDROID_HOME}" ; then
PATH=$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools export ANDROID_HOME
PATH="${PATH}:${ANDROID_HOME}/emulator:${ANDROID_HOME}/platform-tools"
else else
unset ANDROID_HOME unset ANDROID_HOME
fi fi

View File

@@ -6,7 +6,11 @@ if have_command nasm && have_command objdump ; then
local TMPF=`mktemp` local TMPF=`mktemp`
local bytes local bytes
local byte local byte
$NASM -f elf -o $TMPF $1 local format="elf"
if [[ "$OSTYPE" == darwin* ]]; then
format="macho64"
fi
$NASM -f $format -o $TMPF $1
$OBJDUMP -M intel -d $TMPF | grep '^ ' | cut -f2 | while read -A bytes ; do $OBJDUMP -M intel -d $TMPF | grep '^ ' | cut -f2 | while read -A bytes ; do
for byte in $bytes ; do for byte in $bytes ; do
echo -n "\\\\x$byte" echo -n "\\\\x$byte"

View File

@@ -1,5 +1,11 @@
function dumpenv { function dumpenv {
if [ "$(uname)" = "Linux" ]; then
tr '\0' '\n' < /proc/${1}/environ tr '\0' '\n' < /proc/${1}/environ
elif [ "$(uname)" = "Darwin" ]; then
# macOS doesn't have /proc, use ps instead.
# Note: this may truncate if environment is very large.
ps -p ${1} -wwwe -o command= | tr ' ' '\n' | grep '='
fi
} }
if test -x "/sbin/starship" ; then if test -x "/sbin/starship" ; then

View File

@@ -1,8 +1,20 @@
test -f /usr/share/source-highlight/src-hilite-lesspipe.sh && \ # Find src-hilite-lesspipe.sh
_SRCHILITE=""
for _p in /usr/share/source-highlight/src-hilite-lesspipe.sh /opt/homebrew/bin/src-hilite-lesspipe.sh /usr/local/bin/src-hilite-lesspipe.sh ; do
if [ -f "$_p" ] ; then
_SRCHILITE="$_p"
break
fi
done
if [ -n "$_SRCHILITE" ] ; then
function srcless { function srcless {
if [ $# -ne 1 ] ; then if [ $# -ne 1 ] ; then
echo "$0 <what>" > /dev/stderr echo "Usage: srcless <file>" > /dev/stderr
return 1 return 1
fi fi
/usr/share/source-highlight/src-hilite-lesspipe.sh $1 | less -R "$_SRCHILITE" "$1" | less -R
} }
fi
unset _SRCHILITE _p