Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Mar 13, 2024
2 parents ca31a50 + 285f619 commit 4e4a25f
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 88 deletions.
15 changes: 7 additions & 8 deletions .aliases
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,14 @@ alias ungz="gunzip -k"
# File size
alias fs="stat -f \"%z bytes\""

# Empty the Trash on all mounted volumes and the main HDD. then clear the useless sleepimage
alias emptytrash=" \
sudo rm -rfv /Volumes/*/.Trashes; \
rm -rfv ~/.Trash/*; \
sudo rm -v /private/var/vm/sleepimage; \
rm -rv \"/Users/paulirish/Library/Application Support/stremio/Cache\"; \
rm -rv \"/Users/paulirish/Library/Application Support/stremio/stremio-cache\" \
"

# Update installed Ruby gems, Homebrew, npm, and their installed packages
alias brew_update="brew -v update; brew upgrade --force-bottle --cleanup; brew cleanup; brew cask cleanup; brew prune; brew doctor; npm-check -g -u"
alias update_brew_npm_gem='brew_update; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update --no-document'


alias xpraserver='xpra start --printing=no --systemd-run=no --daemon=no :110'

# weird ass behavior without this.
alias watchexec="watchexec --project-origin ."

1 change: 1 addition & 0 deletions .exports
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ export LESS_TERMCAP_us=$(printf '\e[04;36m') # enter underline mode
export FZF_DEFAULT_COMMAND='fd'
export FZF_CTRL_T_COMMAND='fd'
export FZF_CTRL_T_OPTS="--preview 'bat -n --color=always {} 2>/dev/null || tree -C {}'"

2 changes: 1 addition & 1 deletion .functions
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ todatauri () {
# * https://asdf-vm.com/ has lots of fans. i want to try it.
function nvm {
unset -f nvm
export NVM_DIR="/Users/paulirish/.nvm"
export NVM_DIR="$HOME/.nvm"
. "$NVM_DIR/nvm.sh" --no-use
nvm "${@}"
}
Expand Down
2 changes: 1 addition & 1 deletion .gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
mergeorigin = !"git merge origin/$(git mainormaster)"

# Essentially GitHub's compare view: show all 'ahead' changes (incl working tree) vs the merge-base
diffbranch = !"git diff $(git diffbase)"
diffbranch = !"git diff -w $(git diffbase)"
# Diff of branch that's not checked out. Doesn't include working tree (but obv doesnt need to)
diffbranch-that = !"git diff origin/$(git mainormaster)...\"$1\" #"
# Show commit log of unique commits of this branch (not on main)
Expand Down
69 changes: 38 additions & 31 deletions bin/diff-image
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ usage()
echo
}

# https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
hyperlink(){ printf '\e]8;;%s\e\\%s\e]8;;\e\\' "$1" "${2:-$1}";}


backgroundcolor=
color=
Expand Down Expand Up @@ -138,19 +141,21 @@ diff_clean_names()
}


exifdiff=
if which exiftool > /dev/null
then
d1="$(exif "$f1")"
d2="$(exif "$f2")"
diff_clean_names "$d1" "$d2"
set +e
diff -q "$d1" "$d2" >/dev/null
exifdiff=$?
set -e
else
diff_clean_names "$f1" "$f2"
fi
# EHHHHHHHHHhhh.. it's probably interesting somtimes but generally just noise to get this metadata diff
# exifdiff=
# if which exiftool > /dev/null
# then
# d1="$(exif "$f1")"
# d2="$(exif "$f2")"
# diff_clean_names "$d1" "$d2"
# set +e
# diff -q "$d1" "$d2" >/dev/null
# exifdiff=$?
# echo ""
# set -e
# else
# diff_clean_names "$f1" "$f2"
# fi

if $exif_only
then
Expand All @@ -174,10 +179,10 @@ then
exit 1
fi

if [[ $exifdiff = 0 ]] && compare "$f1" "$f2" /dev/null
then
exit 0
fi
# if [[ $exifdiff = 0 ]] && compare "$f1" "$f2" /dev/null
# then
# exit 0
# fi

bn="$(basename "$f1")"
destfile="$(mktemp -t "$bn.XXXXXX").png"
Expand All @@ -187,12 +192,6 @@ then
fuzz='5'
fi

backgroundcolor_flag=
if [ -n "$backgroundcolor" ]
then
backgroundcolor_flag="-background $backgroundcolor"
fi

color_flag=
if [ -n "$color" ]
then
Expand All @@ -208,15 +207,20 @@ fi
density_flag=
do_compare()
{
if which gm > /dev/null
then
echo "NOTICE: GraphicsMagick does not support 'compare -fuzz', so omitting it"
compare $density_flag $color_flag $backgroundcolor_flag -file png:- "$f1" "$f2" | \
montage $density_flag -geometry +4+4 $backgroundcolor_flag "$f1" - "$f2" png:- >"$destfile" 2>/dev/null || true

printf "Computing image diff for: $(basename $f1)"

# choose horiz or vertical stacking based on whats closer to ideal 16:9 of output image.
read -r image1_width image1_height <<< $(identify -format "%w %h" "$f1")
# …At this point i'm not sure this is the math i wanted, but the results seem ok so far.
if ((($image1_width / ($image1_height * 3)) < 16/9)); then
tilearg=3x1
else
compare $density_flag $color_flag $fuzz_flag $backgroundcolor_flag "$f1" "$f2" png:- | \
montage $density_flag -geometry +4+4 $backgroundcolor_flag "$f1" - "$f2" png:- >"$destfile" 2>/dev/null || true
tilearg=1x3
fi

compare $color_flag $fuzz_flag "$f1" "$f2" png:- | \
montage -gravity North -geometry +5+5 -background transparent -tile $tilearg "$f1" - "$f2" png:- >"$destfile" 2>/dev/null || true
}

if which xdg-open > /dev/null
Expand Down Expand Up @@ -257,6 +261,7 @@ then
density_flag="-density $density"
fi


do_compare
if [ -n "$outputPath" ]
then
Expand All @@ -278,7 +283,9 @@ else
echo "Copy diff image to $outputPath"
cp "$destfile" "$outputPath"
else
echo "Showing " "$destfile"
#cho "Computing image diff for: $(basename $f1) …"

echo "" $(hyperlink "file://$destfile" "diff image")
exec open "$destfile"
# imgcat < "$destfile" # i wish this worked but nah. some weird thing where iterm doesnt show it forreal and instaed prints the base64. cant find a bug
fi
Expand Down
14 changes: 13 additions & 1 deletion bin/git_diff_image
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

set -euo pipefail

# this is installed by way of ~/.gitattributes



# if we're running within fzf dont do this
if [ -n "${FZF_COLUMNS-}" ]
then
exit 0
fi


name="$1"
f1="${2-/dev/null}"
f2="${5-/dev/null}"
Expand Down Expand Up @@ -78,4 +89,5 @@ then
fi


exec "$thisdir/diff-image" $e_flag $o_flag -n "$name1" -N "$name2" "$f1" "$f2"
# echo "$thisdir/diff-image" $e_flag $o_flag -n "$name1" -N "$name2" "$f1" "$f2"
"$thisdir/diff-image" $e_flag $o_flag -n "$name1" -N "$name2" "$f1" "$f2"
19 changes: 0 additions & 19 deletions bin/imgdiff

This file was deleted.

9 changes: 1 addition & 8 deletions brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,7 @@ brew install shellcheck # linting for .sh files

# mtr - ping & traceroute. best.
brew install mtr

# allow mtr to run without sudo
# https://github.com/traviscross/mtr/issues/204#issuecomment-487325796
sudo chmod 4755 $location_of_mtr-packet
# on my machine i have a `/usr/local/sbin/mtr-packet` and root owns local/sbin. (thx google!?)
# thus, i dont use the homebrew mtr.


# `abbr mtr "sudo mtr"` to avoid forgetting.

# Install other useful binaries
brew install the_silver_searcher # ack is an alternative, tbh i forget which i like more.
Expand Down
2 changes: 1 addition & 1 deletion docs/clearing-disk-space.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cask cleanup

~/Library/Caches/Google/Chrome Canary/Default
~/Library/Caches/Google/Chrome/Default
~/Library/Application Support/stremio/stremio-cache


# diskexplorer X is good for big files
# daisy disk is good for big folders
Expand Down
10 changes: 7 additions & 3 deletions fish/aliases.fish
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ subcommand_abbr git dbt "diffbranch-that"
subcommand_abbr npm i "install"
#subcommand_abbr pnpm i "install"

abbr mtr "sudo mtr"


# is it a `main` or a `master` repo?
Expand Down Expand Up @@ -147,7 +148,10 @@ alias reportunit 'yarn jest (find report -iname "*-test.js" | grep -v axe)'
# pretty sure watchexec has just won my heart after years of using `entr`
alias reportwatch 'watchexec "node build/build-report-components.js && node build/build-report.js --psi && node build/build-sample-reports.js && echo \$(date) && yarn eslint --fix report/renderer/components.js" && bash core/scripts/copy-util-commonjs.sh'

# dt. rpp
alias rppunit 'npm run unittest -- --expanded-reporting --mocha-fgrep=Processor\|Timeline\|trace\|Trace\|Appender\|Handler\|Performance'
alias rppinter 'npm run interactionstest -- --test-file-pattern="*/performance/**"'
alias rppscreen 'third_party/node/node.py --output scripts/test/run_test_suite.js --config test/interactions/test-runner-config.json --mocha-fgrep "[screenshot]" --test-file-pattern="*/performance/**"'

alias rppunit 'npm run auto-unittest -- --expanded-reporting --mocha-fgrep=Processor\|Timeline\|trace\|Appender\|Handler\|Performance'
alias rppinter 'HTML_OUTPUT_FILE=rppscreenshots.html npm run interactionstest -- --test-file-pattern="*/performance/**"'
alias rppscreen 'HTML_OUTPUT_FILE=rppscreenshots.html third_party/node/node.py --output scripts/test/run_test_suite.js --config test/interactions/test-runner-config.json --mocha-fgrep "[screenshot]" --test-file-pattern="*/performance/**"'

abbr xpraclient "xpra attach --video-scaling=off --desktop-scaling=off --dpi=96 --ssh=/usr/bin/ssh 'ssh://glurp/:110'"
11 changes: 9 additions & 2 deletions fish/chromium.fish
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ function dtb --description "build devtools with a watch loop"
eval $cmd
end

function dtbw --description "use watch_build.js"
cd ./(git rev-parse --show-cdup)

# dont let vpython use a 2.7.. seems to only affect this dude
VPYTHON_BYPASS="manually managed python not supported by chrome operations" node scripts/watch_build.js
end

# https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
# # Avoid the startup dialog for 'Chromium wants to use your confidential information stored in "Chromium Safe Storage" in your keychain'
# # Avoid the startup dialog for 'Do you want the application “Chromium.app” to accept incoming network connections?'
Expand Down Expand Up @@ -150,7 +157,7 @@ end
function glurpgrab --description "dl mac-cross build from glurp"
glurpgrab0

maccr
maccr-flagged
end

function maccr
Expand All @@ -174,7 +181,7 @@ function crflags
--disable-extensions --disable-component-extensions-with-background-pages --disable-background-networking --disable-component-update \
--disable-client-side-phishing-detection --disable-sync --metrics-recording-only --disable-default-apps --mute-audio --no-default-browser-check \
--no-first-run --disable-backgrounding-occluded-windows --disable-renderer-backgrounding --disable-background-timer-throttling --disable-ipc-flooding-protection \
--disable-hang-monitor --enable-logging=stderr $clutch_chrome_flags --user-data-dir=\(mktemp -d "$TMPDIR/chrome-profile-XXXXX"\)
--disable-hang-monitor $clutch_chrome_flags --user-data-dir=/tmp/glurp-mac-cross --enable-logging=stderr
# these two are also good, but tricky to escape for inclusion here: --vmodule='device_event_log*=1' --force-fieldtrials='*BackgroundTracing/default/'
end

Expand Down
6 changes: 6 additions & 0 deletions fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ set -g fish_pager_color_progress cyan
# pull in all shared `export …` aka `set -gx …`
source ~/.exports

# ctrl-b invokes the fancy boi. but this doesnt really work right.
bind \cb git-recent-with-fzf-and-diff
if bind -M insert > /dev/null 2>&1
bind -M insert \cb git-recent-with-fzf-and-diff
end

# TODO debug this
# this currently messes with newlines in my prompt. lets debug it later.
# test -e {$HOME}/.iterm2_shell_integration.fish ; and source {$HOME}/.iterm2_shell_integration.fish
16 changes: 3 additions & 13 deletions fish/functions.fish
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,11 @@ function server -d 'Start a HTTP server in the current dir, optionally specifyin
# arg can either be port number or extra args to statikk
if test $argv[1]
if string match -qr '^-?[0-9]+(\.?[0-9]*)?$' -- "$argv[1]"
echo $argv[1] is a number
set port $argv[1]
statikk --open --port "$port"
# fancy argv thing to pass all remaining args. eg `server --cors --jsprof`
statikk --open --port $argv[1..-1]
else
echo "not a number"
statikk --open $argv[1]
statikk --open $argv[1..-1]
end

else
Expand All @@ -163,15 +162,6 @@ function server -d 'Start a HTTP server in the current dir, optionally specifyin
end


function emptytrash -d 'Empty the Trash on all mounted volumes and the main HDD. then clear the useless sleepimage'
sudo rm -rfv "/Volumes/*/.Trashes"
grm -rf "~/.Trash/*"
rm -rfv "/Users/paulirish/Library/Application Support/stremio/Cache"
rm -rfv "/Users/paulirish/Library/Application Support/stremio/stremio-cache"
rm -rfv "~/Library/Application Support/Spotify/PersistentCache/Update/*.tbz"
rm -rfv ~/Library/Caches/com.spotify.client/Data
rm -rfv ~/Library/Caches/Firefox/Profiles/98ne80k7.dev-edition-default/cache2
end

function conda -d 'lazy initialize conda'
functions --erase conda
Expand Down

0 comments on commit 4e4a25f

Please sign in to comment.