Skip to content

computer

Quick Capture Shortcut for 2023 Vault

Getting the Quick Capture Obsidian (Mac) shortcut working wasn't as I'd worried it would be. I just needed to change a few settings to the new value and change the to process tag.

https://bram-adams.ghost.io/content/images/2023/01/quick-capture-mac-2023-1.png
quick capture mac 2023 1.png
https://bram-adams.ghost.io/content/images/2023/01/quick-capture-mac-2023-2.png
quick capture mac 2023 2.png
https://bram-adams.ghost.io/content/images/2023/01/quick-capture-mac-2023-3.png
quick capture mac 2023 3.png

Showing Hidden Files on Mac

Mac Show Hidden Folders
View Hidden Files in Finder
In Finder, you can click your hard drive under Locations, then open your Macintosh HD folder. Press Command + Shift + . (period) to make the hidden files appear. You can also do the same from inside the Documents, Applications, and Desktop folders. (View Highlight)

I don't know why this can't just be the default option -- I feel like hidden folders would not scare people off like Apple may fear they might. This "simplification" causes more trouble than it solves, and hides important info from users.

Time Sharing

“Computer multitasking in single core microprocessors actually involves time-sharing the processor; only one task can actually be active at a time, but tasks are rotated through many times a second.” (Location 2169)
“Screwing up two things at the same time isn’t multitasking.” (Location 2180)
Project MAC, the world’s first large-scale experiment in personal computing. The project managers there couldn’t hope to give anyone a stand-alone personal computer, of course, not with the cheapest machines still costing hundreds of thousands of dollars. But they could scatter dozens of remote terminals around the campus and in people’s homes. And then, through the technology of “time-sharing,” they could tell their big, central machine to dole out little slices of processing time very, very rapidly, so that each user would feel as if the thing were responding to him or her as an individual. This scheme would work surprisingly well. (Location 157)
Marvin Minsky and John McCarthy, were happy to tell him why. Their computers were straining to keep up with local time-sharing demands as it was, the two AI researchers pointed out at length, supported by many others. And now Larry Roberts wanted the machines to handle packets, too? How were they supposed to get any work done? (Location 6925)

In 2022, we have a similar problem with our models needing beefy GPUs that take up a bunch of compute time.

Day Trip to Solving Fat Images in Obsidian Publish

The Problem

Obsidian Publish uploads and displays images painfully slow (see 202212221234 or 202212160210 for an example of a lot of images). This is probably because Publish is optimized for very light MD files.

This seems like a great one-day project…

Proposed Solutions

  1. Leverage Cloudflare Images, insert !markdown URLs into Publish pages
  2. Compress the everliving fuck out of images and upload them as normal

Cloudflare Route

I already pay for CF Images and used it to build Instabram Stories. In addition, I've already built an automator quick action that allows me to right click any image in Finder, upload it to CF and return the Markdown URL:

function run(input, parameters) {

var filename = "";
var uploaded = "";
var variants = "";

for (var i = 0; i < input.length; i++) {
  if (input[i].includes("filename")) { 
    filename = input[i].split(':')[1].trim().replaceAll('"', '') 
  }

  if (input[i].includes("uploaded")) { 
    uploaded = input[i].split(':')[1].trim().replaceAll('"', '') 
  }

  if (input[i].includes("/public")) { 
    variants = input[i].trim().replaceAll('"', '') 
  }
}

var url = '![' + filename + '-' + uploaded + '](' + variants + ')';

return url;

}

My first step was to try this workflow

https://bram-adams.ghost.io/content/images/2023/01/hxh-rythm-1.png|on-the-image-I-wanted-to-load
hxh rythm 1.png|on the image I wanted to load

which is thiccer than a bowl of oatmeal at 3.8MB

https://bram-adams.ghost.io/content/images/2023/01/thicc-file.png
thicc file.png

Unfortunately this got stuck uploading too for an awkward amount of time and I could only do one at a time. The icing on top of the cake is I'd have a "duplicated" image, locally in my vault and one in CF. No go.

https://bram-adams.ghost.io/content/images/2023/01/cf-images-slow.png
cf images slow.png

Enter the God Tutorial

I followed this tutorial and set an Automator script to listen to new files being added to Private/Screenshots. Check out these savings! 86% savings! And it can run multiple files at once.[1]

I did change the path of the libraries tho:

for f in "$@"
do
  /opt/homebrew/bin/pngquant 64 --skip-if-larger --strip --ext=.png --force "$f"
  /opt/homebrew/bin/zopflipng -y "$f" "$f"
done
https://bram-adams.ghost.io/content/images/2023/01/after-compression.png
after compression.png

For a Netflix screencap, it cut the file by >50% in size without noticeable degradation!

an example (shrunk to 1.8MB)

Screenshot 2022-12-22 16-51-04.png,-2022-12-22T22

Some open (unsolved) problems:

  • starts processing after Alfred notification goes away for shimmering obsidian
  • seems to hang (menu bar gear icon) if multiple files over 1 MB being run
  • i like to move fast with images, the auto compression may take too long at times

Though I eventually took away the folder action in favor of running it manually only on images I'm planning to Publish ↩︎

Compressing Multiple Images at Once

14 image compressions is too many and it fights with shortcuts (single threaded?)[1]

Images took ~35min to process, may offload to some server and put on http calls or something

From the one day image compression project 202212230034


this took >30 seconds to process end to end ↩︎

Compressing Compressed Images

images come out 10x smaller on 1920x1080 screen is there a way to fake that on mbp[1]

from this project 202212230034

still no real solution to 202301100128, except to try and do it on 1920x1080 so the process faster due to smaller base size


this works ↩︎

From Automator to Hazel

Reasoning: Multiple screenshots would lock up entire Mac on shortcuts thread 202301100128, which I couldn't have because I use Alfred SC to run a quick capture Obsidian shortcut

Hazel seems to fix this problem but came with it's own issues. It compressed all the (already compressed) images in the folder at init time, which was annoying.

I had to change the following:

Automator

for f in "$@"
do
  /opt/homebrew/bin/pngquant 64 --skip-if-larger --strip --ext=.png --force "$f"
  /opt/homebrew/bin/zopflipng -y "$f" "$f"
done

Hazel

https://bram-adams.ghost.io/content/images/2023/01/hazel-compress-Screenshot-2023-01-15-00-54-11.png
hazel compress Screenshot 2023-01-15 00-54-11.png
/opt/homebrew/bin/pngquant 64 --skip-if-larger --strip --ext=.png --force "$1"
/opt/homebrew/bin/zopflipng -y "$1" "$1"

In addition, Hazel kept showing this weird error and refused to process newly inserted screenshots. Rules were matching but the workflow wasn't firing

Noodlesoft Forums • View topic - hazel stopped working unless 'forced'

HazelHelper\[99678\] Attempted to run worker on undeployed folder

I had to delete folder and run the whole thing again from scratch to "unstuck" it.

This part especially pissed me off because all the online discourse around Hazel was so positive that I wasn't able to find a good centralized repository with troubleshooting -- and the logs + UI were less than helpful to say why the match was happening but the rule was failing.

am i the only person to say something negative about hazel wth is going on with this app its so weird to maneuver
https://bram-adams.ghost.io/content/images/2023/01/hazel-at-blank-Screenshot-2023-01-15-00-54-49.png
hazel at blank Screenshot 2023-01-15 00-54-49.png

*date added at… (very unhelpful!!)*

Resources:

Do not put jpegs in the Hazel Compression Folder

do not put jpegs in hazel/screenshots folder lol 202212230034, it causes the whole thing to reset 202301150045

2023-01-16 00:33:48.129 hazelworker[61713] Processing folder Screenshots
2023-01-16 00:33:50.200 hazelworker[61713] 202A3B5A-CB81-4383-9F6F-0B2E4138CCFE.jpeg: Rule Compress matched.
2023-01-16 00:33:50.933 hazelworker[61713] [Error] Shell script failed: Error processing shell script on file /Users/bram/Desktop/Obsidian/2023/Private/Screenshots/202A3B5A-CB81-4383-9F6F-0B2E4138CCFE.jpeg.
...
2023-01-16 00:34:04.140 hazelworker[61713] meruem threads needle compression test 8.png: Rule Compress matched.