diff --git a/.aliases b/.aliases index 04255f1b7..cb1688763 100644 --- a/.aliases +++ b/.aliases @@ -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 ." + diff --git a/.exports b/.exports index 25e42da09..1a3d5a52b 100644 --- a/.exports +++ b/.exports @@ -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 {}'" + diff --git a/.functions b/.functions index 16763ac2c..06523b1bb 100644 --- a/.functions +++ b/.functions @@ -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 "${@}" } diff --git a/.gitconfig b/.gitconfig index c26bcfe1b..1c1d75527 100644 --- a/.gitconfig +++ b/.gitconfig @@ -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) diff --git a/bin/diff-image b/bin/diff-image index 9e12768de..4ee80f57e 100755 --- a/bin/diff-image +++ b/bin/diff-image @@ -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= @@ -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 @@ -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" @@ -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 @@ -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 @@ -257,6 +261,7 @@ then density_flag="-density $density" fi + do_compare if [ -n "$outputPath" ] then @@ -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 diff --git a/bin/git_diff_image b/bin/git_diff_image index fe387235c..a9794ae3c 100755 --- a/bin/git_diff_image +++ b/bin/git_diff_image @@ -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}" @@ -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" \ No newline at end of file diff --git a/bin/imgdiff b/bin/imgdiff deleted file mode 100755 index e54ff8e9f..000000000 --- a/bin/imgdiff +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# https://til.hashrocket.com/posts/n44hnf0z99-show-better-image-diff-on-git - -echo "HII $2 $1" - -if [[ -f "$1" ]] && [[ -f "$2" ]]; then - compare "$2" "$1" png:- | montage -geometry +4+4 "$2" - "$1" png:- | imgcat -else - if [[ -f "$1" ]]; then - echo "+ Image Added" - imgcat "$1" - else - echo "- Image Removed" - imgcat "$2" - fi -fi - -exit 0 diff --git a/brew.sh b/brew.sh index b3b1a2638..a66bca84b 100755 --- a/brew.sh +++ b/brew.sh @@ -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. diff --git a/docs/clearing-disk-space.sh b/docs/clearing-disk-space.sh index 181153121..549fd87f7 100644 --- a/docs/clearing-disk-space.sh +++ b/docs/clearing-disk-space.sh @@ -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 diff --git a/fish/aliases.fish b/fish/aliases.fish index 5212ca8f8..cd464fa83 100644 --- a/fish/aliases.fish +++ b/fish/aliases.fish @@ -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? @@ -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/**"' \ No newline at end of file + +abbr xpraclient "xpra attach --video-scaling=off --desktop-scaling=off --dpi=96 --ssh=/usr/bin/ssh 'ssh://glurp/:110'" \ No newline at end of file diff --git a/fish/chromium.fish b/fish/chromium.fish index 9de12e30e..752cd4fb5 100644 --- a/fish/chromium.fish +++ b/fish/chromium.fish @@ -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?' @@ -150,7 +157,7 @@ end function glurpgrab --description "dl mac-cross build from glurp" glurpgrab0 - maccr + maccr-flagged end function maccr @@ -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 diff --git a/fish/config.fish b/fish/config.fish index c87b32db8..152b01ade 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -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 diff --git a/fish/functions.fish b/fish/functions.fish index 6d1e06547..4ad87e48e 100644 --- a/fish/functions.fish +++ b/fish/functions.fish @@ -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 @@ -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