<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>MacOS on Ricky</title><link>https://995facee.rickylin.pages.dev/tags/macos/</link><description>Recent content in MacOS on Ricky</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sat, 20 Jun 2026 22:55:33 +0800</lastBuildDate><atom:link href="https://995facee.rickylin.pages.dev/tags/macos/index.xml" rel="self" type="application/rss+xml"/><item><title>Local LLM on MacBookPro - Image</title><link>https://995facee.rickylin.pages.dev/posts/2026/20260620-local-llm-image/</link><pubDate>Sat, 20 Jun 2026 22:55:33 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2026/20260620-local-llm-image/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://huggingface.co/mlx-community" target="_blank" rel="noopener">https://huggingface.co/mlx-community&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/filipstrand/mflux" target="_blank" rel="noopener">https://github.com/filipstrand/mflux&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/lpalbou/mlx-gen" target="_blank" rel="noopener">https://github.com/lpalbou/mlx-gen&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://huggingface.co/AbstractFramework" target="_blank" rel="noopener">https://huggingface.co/AbstractFramework&lt;/a>&lt;/li>
&lt;/ul>
&lt;h4 id="install">Install&lt;/h4>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>uv tool install --upgrade mflux
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uv tool install --upgrade --force mlx-gen
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="download-model">Download Model&lt;/h4>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># mlx-community/FLUX.2-klein-9B&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># AbstractFramework/z-image-turbo-8bit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># AbstractFramework/qwen-image-edit-2511-8bit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>HF_HUB_DISABLE_XET&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span> hf download mlx-community/FLUX.2-klein-9B --local-dir FLUX.2-klein-9B --max-workers &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="run">Run&lt;/h4>
&lt;h5 id="flux2-klein-9b">FLUX.2-klein-9B&lt;/h5>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>mflux-generate-flux2 &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --model &lt;span style="color:#e6db74">&amp;#34;/Users/ricky/git/mlx/FLUX.2-klein-9B&amp;#34;&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --prompt &lt;span style="color:#e6db74">&amp;#39;Charmander from Pokemon, a specific Nintendo character, iconic appearance, very clean large eyes, friendly wide smile, smooth round belly, long distinct tail with simple flame outlines&amp;#39;&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --steps &lt;span style="color:#ae81ff">6&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --seed &lt;span style="color:#ae81ff">42&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --width &lt;span style="color:#ae81ff">1240&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --height &lt;span style="color:#ae81ff">1754&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --output pics/charmander.png
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h5 id="z-image-turbo-8bit">z-image-turbo-8bit&lt;/h5>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>mlxgen generate &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --model /Users/ricky/git/mlx/z-image-turbo-8bit &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --prompt &lt;span style="color:#e6db74">&amp;#39;哆啦Ａ夢使用竹蜻蜓飛在天空中&amp;#39;&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --steps &lt;span style="color:#ae81ff">6&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --seed &lt;span style="color:#ae81ff">42&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --width &lt;span style="color:#ae81ff">1240&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --height &lt;span style="color:#ae81ff">1754&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --output pics/doramon.png
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h5 id="qwen-image-edit-2511-8bit">qwen-image-edit-2511-8bit&lt;/h5>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>mlxgen generate &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --model /Users/ricky/git/mlx/qwen-image-edit-2511-8bit &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --prompt &lt;span style="color:#e6db74">&amp;#39;哆啦Ａ夢使用竹蜻蜓飛在天空中，旁邊有大雄&amp;#39;&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --steps &lt;span style="color:#ae81ff">6&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --seed &lt;span style="color:#ae81ff">42&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --width &lt;span style="color:#ae81ff">1240&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --height &lt;span style="color:#ae81ff">1754&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --image-path pics/doramon.png &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --output pics/doramon1.png
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Articles</title><link>https://995facee.rickylin.pages.dev/posts/2026/20260610-articles/</link><pubDate>Wed, 10 Jun 2026 10:59:53 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2026/20260610-articles/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://pokeemerald.com/" target="_blank" rel="noopener">Pokemon Emerald in WebAssembly(https://github.com/tripplyons/pokeemerald-wasm)&lt;/a>&lt;/li>
&lt;li>&lt;strong>Github&lt;/strong>
&lt;ul>
&lt;li>&lt;a href="https://github.com/wxt-dev/wxt" target="_blank" rel="noopener">wxt: Next-gen Web Extension Framework&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/anthropics/defending-code-reference-harness" target="_blank" rel="noopener">Skills for threat modeling, scanning, triage, patching, plus an autonomous scanning harness you can &lt;code>/customize&lt;/code>&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/ad-si/awesome-3d-printing" target="_blank" rel="noopener">A curated list of awesome 3D printing resources&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/NousResearch/hermes-agent" target="_blank" rel="noopener">hermes-agent: It&amp;rsquo;s the only agent with a built-in learning loop - it creates skills from experience, improves them during use, nudges itself to persist knowledge, searches its own past conversations, and builds a deepening model of who you are across sessions. Run it on a $5 VPS, a GPU cluster, or serverless infrastructure that costs nearly nothing when idle. It&amp;rsquo;s not tied to your laptop - talk to it from Telegram while it works on a cloud VM.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/mysk-research/loupe" target="_blank" rel="noopener">loupe: A privacy-focused iOS app that raises awareness about what native apps can see(https://apps.apple.com/cn/app/loupe-app%E8%83%BD%E7%9C%8B%E5%88%B0%E4%BB%80%E4%B9%88/id6766152470)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/RoversX/LaunchNext" target="_blank" rel="noopener">LaunchNext: Bring your Launchpad back in MacOS26+ ,highly customizable, powerful, free.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/skeeto/endlessh" target="_blank" rel="noopener">endlessh: SSH tarpit that slowly sends an endless banner&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/akerouanton/iptables-tracer" target="_blank" rel="noopener">iptables-tracer: Trace packets as they go through iptables chains&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/serverless-dns/serverless-dns" target="_blank" rel="noopener">serverless-dns: The RethinkDNS resolver that deploys to Cloudflare Workers, Deno Deploy, Fastly, and Fly.io&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/ouch-org/ouch" target="_blank" rel="noopener">ouch: stands for Obvious Unified Compression Helper. It&amp;rsquo;s a CLI tool for compressing and decompressing various formats.(https://github.com/ouch-org/ouch#supported-formats)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/shell-pool/shpool" target="_blank" rel="noopener">shpool: shpool is a service that enables session persistence by allowing the creation of named shell sessions owned by shpool so that the session is not lost if the connection drops. shpool can be thought of as a lighter weight alternative to tmux or GNU screen. While tmux and screen take over the whole terminal and provide window splitting and tiling features, shpool only provides persistent sessions. The biggest advantage of this approach is that shpool does not break native scrollback or copy-paste.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/google/capslock" target="_blank" rel="noopener">capslock: is a capability analysis CLI for Go packages that informs users of which privileged operations a given package can access. This works by classifying the capabilities of Go packages by following transitive calls to privileged standard library operations.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/psviderski/unregistry" target="_blank" rel="noopener">unregistry: Push docker images directly to remote servers without an external registry&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/Ranchero-Software/NetNewsWire" target="_blank" rel="noopener">NetNewsWire is a free and open-source feed reader for macOS and iOS. It supports RSS, Atom, JSON Feed, and RSS-in-JSON formats.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/k4yt3x/sysctl" target="_blank" rel="noopener">K4YT3X&amp;rsquo;s Hardened &amp;amp; Optimized Linux Kernel Parameters&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/tursodatabase/turso" target="_blank" rel="noopener">Turso is an in-process SQL database, compatible with SQLite.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/zizmorcore/zizmor" target="_blank" rel="noopener">zizmor is a static analysis tool for GitHub Actions.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/rustfs/rustfs" target="_blank" rel="noopener">RustFS is a high-performance, distributed object storage system built in Rust.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/jdx/usage" target="_blank" rel="noopener">Usage: is a spec and CLI for defining CLI tools. Arguments, flags, environment variables, and config files can all be defined in a Usage spec. It can be thought of like OpenAPI (swagger) for CLIs.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/MODSetter/SurfSense" target="_blank" rel="noopener">SurfSense: An open source, privacy focused alternative to NotebookLM for teams with no data limits.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/icann/icann-rdap" target="_blank" rel="noopener">ICANN implementation of the Registry Data Access Protocol (RDAP)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/openrdap/rdap" target="_blank" rel="noopener">OpenRDAP is a command line RDAP client implementation in Go.&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;strong>Article&lt;/strong>
&lt;ul>
&lt;li>&lt;a href="https://blog.ammaraskar.com/github-token-stealing/" target="_blank" rel="noopener">1-Click GitHub Token Stealing via a VSCode Bug&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.zhihu.com/question/590661860" target="_blank" rel="noopener">Linux 系统误将 chmod 权限改成 了 000，如何恢复?&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://ahelwer.ca/post/2026-05-08-builtin-u2f/" target="_blank" rel="noopener">Laptops all have built-in security tokens these days&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://tailscale.com/blog/tailscale-rustdesk-remote-desktop-access" target="_blank" rel="noopener">Tailscale and RustDesk: Secure remote access to all your desktops&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://blog.trailofbits.com/2025/06/17/unexpected-security-footguns-in-gos-parsers/" target="_blank" rel="noopener">Unexpected security footguns in Go&amp;rsquo;s parsers&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://marvin.yabi.me/misc/junzishendoo.htm" target="_blank" rel="noopener">君子慎讀&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://marvin.yabi.me/misc/wenbai.htm" target="_blank" rel="noopener">辭典中標注的「讀音」和「語音」是什麼？&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://marvin.yabi.me/misc/AND.htm" target="_blank" rel="noopener">拜託別再「我汗你」了！&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="linux-系统误将-chmod-权限改成-了-000如何恢复">Linux 系统误将 chmod 权限改成 了 000，如何恢复?&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c" data-lang="c">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;sys/stat.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">int&lt;/span> &lt;span style="color:#a6e22e">main&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">chmod&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;/usr/bin/chmod&amp;#34;&lt;/span>, &lt;span style="color:#ae81ff">0755&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#ae81ff">0&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>ubuntu@ubuntu:~$ which chmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>/usr/bin/chmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ubuntu@ubuntu:~$ ls -lh /usr/bin/chmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>lrwxrwxrwx &lt;span style="color:#ae81ff">1&lt;/span> root root &lt;span style="color:#ae81ff">8&lt;/span> Sep &lt;span style="color:#ae81ff">27&lt;/span> &lt;span style="color:#ae81ff">2025&lt;/span> /usr/bin/chmod -&amp;gt; gnuchmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ubuntu@ubuntu:~$ ls -lh /usr/bin/gnuchmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rwxr-xr-x &lt;span style="color:#ae81ff">1&lt;/span> root root 67K Jan &lt;span style="color:#ae81ff">23&lt;/span> 21:34 /usr/bin/gnuchmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ubuntu@ubuntu:~$ sudo chmod &lt;span style="color:#ae81ff">000&lt;/span> /usr/bin/chmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ubuntu@ubuntu:~$ ls -lh /usr/bin/chmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>lrwxrwxrwx &lt;span style="color:#ae81ff">1&lt;/span> root root &lt;span style="color:#ae81ff">8&lt;/span> Sep &lt;span style="color:#ae81ff">27&lt;/span> &lt;span style="color:#ae81ff">2025&lt;/span> /usr/bin/chmod -&amp;gt; gnuchmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ubuntu@ubuntu:~$ ls -lh /usr/bin/gnuchmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>---------- &lt;span style="color:#ae81ff">1&lt;/span> root root 67K Jan &lt;span style="color:#ae81ff">23&lt;/span> 21:34 /usr/bin/gnuchmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ubuntu@ubuntu:~$ cat main.c
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include &amp;lt;sys/stat.h&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>int main&lt;span style="color:#f92672">()&lt;/span> &lt;span style="color:#f92672">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> chmod&lt;span style="color:#f92672">(&lt;/span>&lt;span style="color:#e6db74">&amp;#34;/usr/bin/chmod&amp;#34;&lt;/span>, 0755&lt;span style="color:#f92672">)&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> 0;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ubuntu@ubuntu:~$ gcc ./main.c
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ubuntu@ubuntu:~$ sudo ./a.out
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ubuntu@ubuntu:~$ ls -lh /usr/bin/chmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>lrwxrwxrwx &lt;span style="color:#ae81ff">1&lt;/span> root root &lt;span style="color:#ae81ff">8&lt;/span> Sep &lt;span style="color:#ae81ff">27&lt;/span> &lt;span style="color:#ae81ff">2025&lt;/span> /usr/bin/chmod -&amp;gt; gnuchmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ubuntu@ubuntu:~$ ls -lh /usr/bin/gnuchmod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rwxr-xr-x &lt;span style="color:#ae81ff">1&lt;/span> root root 67K Jan &lt;span style="color:#ae81ff">23&lt;/span> 21:34 /usr/bin/gnuchmod
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h2 id="laptops-all-have-built-in-security-tokens-these-days">Laptops all have built-in security tokens these days&lt;/h2>
&lt;h3 id="macos">macOS&lt;/h3>
&lt;blockquote>
&lt;p>&lt;a href="https://github.com/yubico/libfido2" target="_blank" rel="noopener">https://github.com/yubico/libfido2&lt;/a>&lt;/p></description></item><item><title>Local LLM on MacBookPro</title><link>https://995facee.rickylin.pages.dev/posts/2026/20260601-local-llm/</link><pubDate>Mon, 01 Jun 2026 10:58:17 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2026/20260601-local-llm/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://huggingface.co/mlx-community" target="_blank" rel="noopener">https://huggingface.co/mlx-community&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/ml-explore/mlx-lm" target="_blank" rel="noopener">https://github.com/ml-explore/mlx-lm&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/jundot/omlx" target="_blank" rel="noopener">https://github.com/jundot/omlx&lt;/a>&lt;/li>
&lt;/ul>
&lt;h4 id="install">Install&lt;/h4>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># install hf&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uv tool install &lt;span style="color:#e6db74">&amp;#34;huggingface_hub&amp;#34;&lt;/span> --with hf-xet --upgrade
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>hf auth login
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>hf auth whoami
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># install mlx_lm&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uv tool install --force &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --from &lt;span style="color:#e6db74">&amp;#39;git+https://github.com/ml-explore/mlx-lm.git@refs/pull/1192/head&amp;#39;&lt;/span> mlx-lm &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --with &lt;span style="color:#e6db74">&amp;#39;transformers @ git+https://github.com/huggingface/transformers.git&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># install mlx-openai-server&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uv pip install git+https://github.com/cubist38/mlx-openai-server.git --system
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># install [litellm](https://github.com/BerriAI/litellm)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uv tool install &lt;span style="color:#e6db74">&amp;#39;litellm[proxy]&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># install [claw-code](https://github.com/ultraworkers/claw-code)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cargo install agent-code
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="download-model">Download Model&lt;/h4>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>HF_HUB_DISABLE_XET&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span> hf download mlx-community/DeepSeek-V4-Flash-4bit &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --local-dir deepseekV4 --repo-type model
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="run-server">Run Server&lt;/h4>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>mlx_lm.server --model /Users/ricky/git/mlx/deepseekV4 --port &lt;span style="color:#ae81ff">8080&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>or&lt;/strong>&lt;/p></description></item><item><title>Articles</title><link>https://995facee.rickylin.pages.dev/posts/2026/20260513-articles/</link><pubDate>Wed, 13 May 2026 11:15:33 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2026/20260513-articles/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://github.com/itgoyo/TelegramChannels" target="_blank" rel="noopener">TelegramChannels&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/warp-tech/warpgate" target="_blank" rel="noopener">warpgate: is a smart &amp;amp; fully transparent SSH, HTTPS, Kubernetes, MySQL, PostgreSQL bastion host that doesn&amp;rsquo;t require a client app or an SSH wrapper.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://jakub.kr/writing/details-that-make-interfaces-feel-better" target="_blank" rel="noopener">Details that make interfaces feel better: &lt;code>npx skills add jakubkrehel/make-interfaces-feel-better&lt;/code>&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/TheStageAI/TheWhisper" target="_blank" rel="noopener">TheWhisper: High-Performance Speech-to-Text&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/nexu-io/open-design" target="_blank" rel="noopener">Open Design: The open-source alternative to Claude Design. Local-first, web-deployable, BYOK at every layer — 16 coding-agent CLIs auto-detected on your PATH (Claude Code, Codex, Devin for Terminal, Cursor Agent, Gemini CLI, OpenCode, Qwen, Qoder CLI, GitHub Copilot CLI, Hermes, Kimi, Pi, Kiro, Kilo, Mistral Vibe, DeepSeek TUI) become the design engine, driven by 31 composable Skills and 72 brand-grade Design Systems. No CLI? An OpenAI-compatible BYOK proxy is the same loop minus the spawn.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/ultraworkers/claw-code" target="_blank" rel="noopener">Claw Code is the public Rust implementation of the claw CLI agent harness. The canonical implementation lives in rust/, and the current source of truth for this repository is ultraworkers/claw-code.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/LING71671/Open-ClaudeCode" target="_blank" rel="noopener">Open-ClaudeCode: 完整开源的 Claude Code 项目 - 基于 Anthropic 官方源码重建&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/claude-code-best/claude-code" target="_blank" rel="noopener">Claude Code Best V5 (CCB): 牢 A (Anthropic) 官方 Claude Code CLI 工具的源码反编译/逆向还原项目。目标是将 Claude Code 大部分功能及工程化能力复现 (问就是老佛爷已经付过钱了)。虽然很难绷, 但是它叫做 CCB(踩踩背)&amp;hellip; 而且, 我们实现了企业版或者需要登陆 Claude 账号才能使用的特性, 实现技术普惠&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/aattaran/deepclaude" target="_blank" rel="noopener">deepclaude: Use Claude Code&amp;rsquo;s autonomous agent loop with DeepSeek V4 Pro, OpenRouter, or any Anthropic-compatible backend. Same UX, 17x cheaper.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/pyinfra-dev/pyinfra" target="_blank" rel="noopener">pyinfra turns Python code into shell commands and runs them on your servers. Execute ad-hoc commands and write declarative operations. Target SSH servers, local machine and Docker containers. Fast and scales from one server to thousands. Think ansible but Python instead of YAML, and a lot faster.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/jdx/mise" target="_blank" rel="noopener">mise: Dev tools, env vars, and tasks in one CLI&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/endevco/aube" target="_blank" rel="noopener">Aube installs automatically when you run a script. The tightest security defaults of any Node.js package manager - and the only one with a lifecycle-script jail. Drops into existing projects using existing lockfiles.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/V4bel/dirtyfrag" target="_blank" rel="noopener">Dirty Frag: Universal Linux LPE&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://sinceyouarrived.world/taken" target="_blank" rel="noopener">taken. You opened this page. It already knows the following.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://internetarchive.ch/" target="_blank" rel="noopener">internetarchive.ch&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://blog.kronis.dev/blog/apple-is-increasing-my-cortisol-levels" target="_blank" rel="noopener">Apple is increasing my cortisol levels&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/dwarvesf/hidden" target="_blank" rel="noopener">Hidden Bar lets you hide menu bar items to give your Mac a cleaner look.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/stonerl/Thaw" target="_blank" rel="noopener">Thaw is a powerful menu bar management tool for macOS 26. While its primary function is hiding and showing menu bar items, it aims to cover a wide variety of additional features to make it one of the most versatile menu bar tools available.&lt;/a>&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="dirty-frag">Dirty Frag&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>git clone https://github.com/V4bel/dirtyfrag.git &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> cd dirtyfrag &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> gcc -O0 -Wall -o exp exp.c -lutil &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> ./exp
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Articles</title><link>https://995facee.rickylin.pages.dev/posts/2026/20260415-articles/</link><pubDate>Wed, 15 Apr 2026 09:22:42 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2026/20260415-articles/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://ganhua.wang/singleflight" target="_blank" rel="noopener">SingleFlight&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://catcoding.me/p/apple-gatekeeper-scan/" target="_blank" rel="noopener">macOS 奇怪的安全扫码机制&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/xindoo/agentic-design-patterns" target="_blank" rel="noopener">Agentic Design Patterns&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://tw93.fun/2026-03-12/claude.html" target="_blank" rel="noopener">你不知道的 Claude Code：架构、治理与工程实践&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://tw93.fun/2026-03-21/agent.html" target="_blank" rel="noopener">你不知道的 Agent：原理、架构与工程实践&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/rtk-ai/rtk" target="_blank" rel="noopener">rtk: CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/Wilfred/difftastic" target="_blank" rel="noopener">difftastic: a structural diff that understands syntax&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.anisafifi.com/en/blog/i-ditched-elasticsearch-for-meilisearch-heres-what-nobody-tells-you/" target="_blank" rel="noopener">I Ditched Elasticsearch for Meilisearch. Here&amp;rsquo;s What Nobody Tells You.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://taiwan.md/" target="_blank" rel="noopener">策展島嶼的深度敘事&lt;/a>: &lt;a href="https://github.com/frank890417/taiwan-md" target="_blank" rel="noopener">https://github.com/frank890417/taiwan-md&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://colobu.com/2025/11/01/Linux%20%E4%B8%AD%E7%BD%91%E7%BB%9C%E5%8C%85%E7%9A%84%E4%B8%80%E7%94%9F/index/" target="_blank" rel="noopener">Linux 中网络包的一生&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/coderamp-labs/gitingest" target="_blank" rel="noopener">Gitingest: Turn any Git repository into a prompt-friendly text ingest for LLMs.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.ilograph.com/blog/posts/more-common-diagram-mistakes/" target="_blank" rel="noopener">7 More Common Mistakes in Architecture Diagrams&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://claude.com/resources/use-cases" target="_blank" rel="noopener">Use Cases&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/obra/superpowers" target="_blank" rel="noopener">Superpowers&lt;/a>: Superpowers is a complete software development workflow for your coding agents, built on top of a set of composable &amp;ldquo;skills&amp;rdquo; and some initial instructions that make sure your agent uses them.&lt;/li>
&lt;li>&lt;a href="https://github.com/affaan-m/everything-claude-code" target="_blank" rel="noopener">everything-claude-code&lt;/a>: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.&lt;/li>
&lt;li>&lt;a href="https://github.com/msitarzewski/agency-agents" target="_blank" rel="noopener">Agency Agents&lt;/a>: A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.&lt;/li>
&lt;li>&lt;a href="https://github.com/666ghj/MiroFish" target="_blank" rel="noopener">MiroFish: A Simple and Universal Swarm Intelligence Engine, Predicting Anything.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/lightpanda-io/browser" target="_blank" rel="noopener">Lightpanda Browser: the headless browser designed for AI and automation&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://blog.dailydoseofds.com/p/anatomy-of-the-claude-folder" target="_blank" rel="noopener">Anatomy of the .claude/ Folder&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/J-x-Z/cocoa-way" target="_blank" rel="noopener">Cocoa-Way: Native macOS Wayland Compositor written in Rust using Smithay. Experience seamless Linux app streaming on macOS without XQuartz.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/chenglou/pretext" target="_blank" rel="noopener">Pretext: Fast, accurate &amp;amp; comprehensive text measurement &amp;amp; layout&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.mgrunwald.com/ghostmoon/" target="_blank" rel="noopener">Ghostmoon.app: A Swiss Army Knife for your macOS menu bar&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.codingfont.com/" target="_blank" rel="noopener">CodingFont: A game to help you pick a coding font&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://piechowski.io/post/git-commands-before-reading-code/" target="_blank" rel="noopener">The Git Commands I Run Before Reading Any Code&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/memstechtips/Winhance" target="_blank" rel="noopener">Winhance: Application designed to optimize, customize and enhance your Windows experience.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://arhan.sh/blog/native-instant-space-switching-on-macos/" target="_blank" rel="noopener">Native Instant Space Switching on MacOS&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/Fluid-CAD/FluidCAD" target="_blank" rel="noopener">FluidCAD: Write CAD models in JavaScript. See the result in real time.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/VoltAgent/awesome-design-md" target="_blank" rel="noopener">Awesome DESIGN.md: Copy a DESIGN.md into your project, tell your AI agent &amp;ldquo;build me a page that looks like this&amp;rdquo; and get pixel-perfect UI that actually matches.&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/safishamsi/graphify" target="_blank" rel="noopener">graphify&lt;/a>: AI coding assistant skill (Claude Code, Codex, OpenCode, Cursor, Gemini CLI, GitHub Copilot CLI, OpenClaw, Factory Droid, Trae, Google Antigravity). Turn any folder of code, docs, papers, images, or videos into a queryable knowledge graph&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="singleflight">SingleFlight&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">package&lt;/span> &lt;span style="color:#a6e22e">analyzer&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> (
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;context&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;sync&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;golang.org/x/sync/singleflight&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;github.com/nathan/stock_bot/internal/storage&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">type&lt;/span> &lt;span style="color:#a6e22e">AnalysisService&lt;/span> &lt;span style="color:#66d9ef">struct&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">genai&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">GenAIClient&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">d1Client&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">storage&lt;/span>.&lt;span style="color:#a6e22e">D1Client&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">stockCache&lt;/span> &lt;span style="color:#66d9ef">map&lt;/span>[&lt;span style="color:#66d9ef">string&lt;/span>]&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">StockAnalysisResult&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">mu&lt;/span> &lt;span style="color:#a6e22e">sync&lt;/span>.&lt;span style="color:#a6e22e">RWMutex&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">sf&lt;/span> &lt;span style="color:#a6e22e">singleflight&lt;/span>.&lt;span style="color:#a6e22e">Group&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">func&lt;/span> (&lt;span style="color:#a6e22e">s&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">AnalysisService&lt;/span>) &lt;span style="color:#a6e22e">analyzeStock&lt;/span>(&lt;span style="color:#a6e22e">ctx&lt;/span> &lt;span style="color:#a6e22e">context&lt;/span>.&lt;span style="color:#a6e22e">Context&lt;/span>, &lt;span style="color:#a6e22e">code&lt;/span>, &lt;span style="color:#a6e22e">name&lt;/span> &lt;span style="color:#66d9ef">string&lt;/span>) (&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">StockAnalysisResult&lt;/span>, &lt;span style="color:#66d9ef">error&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 1. 第一層防護：檢查記憶體快取 (L1 Cache)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">mu&lt;/span>.&lt;span style="color:#a6e22e">RLock&lt;/span>()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#a6e22e">result&lt;/span>, &lt;span style="color:#a6e22e">ok&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">stockCache&lt;/span>[&lt;span style="color:#a6e22e">code&lt;/span>]; &lt;span style="color:#a6e22e">ok&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">mu&lt;/span>.&lt;span style="color:#a6e22e">RUnlock&lt;/span>()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#a6e22e">result&lt;/span>, &lt;span style="color:#66d9ef">nil&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">mu&lt;/span>.&lt;span style="color:#a6e22e">RUnlock&lt;/span>()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 2. 第二層防護：Singleflight (請求合併)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">key&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;stock:&amp;#34;&lt;/span> &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#a6e22e">code&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">v&lt;/span>, &lt;span style="color:#a6e22e">err&lt;/span>, &lt;span style="color:#a6e22e">_&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">sf&lt;/span>.&lt;span style="color:#a6e22e">Do&lt;/span>(&lt;span style="color:#a6e22e">key&lt;/span>, &lt;span style="color:#66d9ef">func&lt;/span>() (&lt;span style="color:#66d9ef">interface&lt;/span>{}, &lt;span style="color:#66d9ef">error&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 3. 執行昂貴的邏輯 (DB + Gemini API)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">result&lt;/span>, &lt;span style="color:#a6e22e">err&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">doAnalyzeStock&lt;/span>(&lt;span style="color:#a6e22e">ctx&lt;/span>, &lt;span style="color:#a6e22e">code&lt;/span>, &lt;span style="color:#a6e22e">name&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#a6e22e">err&lt;/span> &lt;span style="color:#f92672">!=&lt;/span> &lt;span style="color:#66d9ef">nil&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#66d9ef">nil&lt;/span>, &lt;span style="color:#a6e22e">err&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 4. 寫入快取 (務必在 singleflight 內部完成，防止下一波瞬間擊穿)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">mu&lt;/span>.&lt;span style="color:#a6e22e">Lock&lt;/span>()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">stockCache&lt;/span>[&lt;span style="color:#a6e22e">code&lt;/span>] = &lt;span style="color:#a6e22e">result&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">mu&lt;/span>.&lt;span style="color:#a6e22e">Unlock&lt;/span>()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#a6e22e">result&lt;/span>, &lt;span style="color:#66d9ef">nil&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> })
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#a6e22e">err&lt;/span> &lt;span style="color:#f92672">!=&lt;/span> &lt;span style="color:#66d9ef">nil&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#66d9ef">nil&lt;/span>, &lt;span style="color:#a6e22e">err&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#a6e22e">v&lt;/span>.(&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">StockAnalysisResult&lt;/span>), &lt;span style="color:#66d9ef">nil&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">func&lt;/span> (&lt;span style="color:#a6e22e">s&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">AnalysisService&lt;/span>) &lt;span style="color:#a6e22e">doAnalyzeStock&lt;/span>(&lt;span style="color:#a6e22e">ctx&lt;/span> &lt;span style="color:#a6e22e">context&lt;/span>.&lt;span style="color:#a6e22e">Context&lt;/span>, &lt;span style="color:#a6e22e">code&lt;/span>, &lt;span style="color:#a6e22e">name&lt;/span> &lt;span style="color:#66d9ef">string&lt;/span>) (&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">StockAnalysisResult&lt;/span>, &lt;span style="color:#66d9ef">error&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 建立一個子 Context 用於內部的多個非同步任務&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">g&lt;/span>, &lt;span style="color:#a6e22e">ctx&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#a6e22e">errgroup&lt;/span>.&lt;span style="color:#a6e22e">WithContext&lt;/span>(&lt;span style="color:#a6e22e">ctx&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> &lt;span style="color:#a6e22e">dbData&lt;/span> &lt;span style="color:#66d9ef">string&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> &lt;span style="color:#a6e22e">aiResult&lt;/span> &lt;span style="color:#66d9ef">string&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 任務 1：查資料庫&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">g&lt;/span>.&lt;span style="color:#a6e22e">Go&lt;/span>(&lt;span style="color:#66d9ef">func&lt;/span>() &lt;span style="color:#66d9ef">error&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 隨時檢查 Context 是否已取消&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">select&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">case&lt;/span> &lt;span style="color:#f92672">&amp;lt;-&lt;/span>&lt;span style="color:#a6e22e">ctx&lt;/span>.&lt;span style="color:#a6e22e">Done&lt;/span>():
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#a6e22e">ctx&lt;/span>.&lt;span style="color:#a6e22e">Err&lt;/span>()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">default&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 模擬資料庫查詢&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">dbData&lt;/span> = &lt;span style="color:#e6db74">&amp;#34;Historical Data&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#66d9ef">nil&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> })
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 任務 2：呼叫 Gemini API&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">g&lt;/span>.&lt;span style="color:#a6e22e">Go&lt;/span>(&lt;span style="color:#66d9ef">func&lt;/span>() &lt;span style="color:#66d9ef">error&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 將 ctx 傳入 API 客戶端，讓它能跟隨整體的超時控制&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">res&lt;/span>, &lt;span style="color:#a6e22e">err&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">genai&lt;/span>.&lt;span style="color:#a6e22e">Generate&lt;/span>(&lt;span style="color:#a6e22e">ctx&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;Analyze this: &amp;#34;&lt;/span>&lt;span style="color:#f92672">+&lt;/span>&lt;span style="color:#a6e22e">code&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#a6e22e">err&lt;/span> &lt;span style="color:#f92672">!=&lt;/span> &lt;span style="color:#66d9ef">nil&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#a6e22e">err&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">aiResult&lt;/span> = &lt;span style="color:#a6e22e">res&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#66d9ef">nil&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> })
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 等待所有任務完成或其中一個出錯&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#a6e22e">err&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#a6e22e">g&lt;/span>.&lt;span style="color:#a6e22e">Wait&lt;/span>(); &lt;span style="color:#a6e22e">err&lt;/span> &lt;span style="color:#f92672">!=&lt;/span> &lt;span style="color:#66d9ef">nil&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#66d9ef">nil&lt;/span>, &lt;span style="color:#a6e22e">err&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#f92672">&amp;amp;&lt;/span>&lt;span style="color:#a6e22e">StockAnalysisResult&lt;/span>{&lt;span style="color:#a6e22e">Data&lt;/span>: &lt;span style="color:#a6e22e">dbData&lt;/span>, &lt;span style="color:#a6e22e">Analysis&lt;/span>: &lt;span style="color:#a6e22e">aiResult&lt;/span>}, &lt;span style="color:#66d9ef">nil&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">func&lt;/span> (&lt;span style="color:#a6e22e">s&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">AnalysisService&lt;/span>) &lt;span style="color:#a6e22e">analyzeStockWithMetrics&lt;/span>(&lt;span style="color:#a6e22e">ctx&lt;/span> &lt;span style="color:#a6e22e">context&lt;/span>.&lt;span style="color:#a6e22e">Context&lt;/span>, &lt;span style="color:#a6e22e">code&lt;/span> &lt;span style="color:#66d9ef">string&lt;/span>) (&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">StockAnalysisResult&lt;/span>, &lt;span style="color:#66d9ef">error&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">key&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;stock:&amp;#34;&lt;/span> &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#a6e22e">code&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">v&lt;/span>, &lt;span style="color:#a6e22e">err&lt;/span>, &lt;span style="color:#a6e22e">shared&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">sf&lt;/span>.&lt;span style="color:#a6e22e">Do&lt;/span>(&lt;span style="color:#a6e22e">key&lt;/span>, &lt;span style="color:#66d9ef">func&lt;/span>() (&lt;span style="color:#66d9ef">interface&lt;/span>{}, &lt;span style="color:#66d9ef">error&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">doAnalyzeStock&lt;/span>(&lt;span style="color:#a6e22e">ctx&lt;/span>, &lt;span style="color:#a6e22e">code&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;Name&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> })
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 紀錄監控指標：分辨是「原始呼叫」還是「共享結果」&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">status&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;original&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#a6e22e">shared&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">status&lt;/span> = &lt;span style="color:#e6db74">&amp;#34;shared&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">s&lt;/span>.&lt;span style="color:#a6e22e">sfCounter&lt;/span>.&lt;span style="color:#a6e22e">Add&lt;/span>(&lt;span style="color:#a6e22e">ctx&lt;/span>, &lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#a6e22e">metric&lt;/span>.&lt;span style="color:#a6e22e">WithAttributes&lt;/span>(
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">attribute&lt;/span>.&lt;span style="color:#a6e22e">String&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;stock_code&amp;#34;&lt;/span>, &lt;span style="color:#a6e22e">code&lt;/span>),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">attribute&lt;/span>.&lt;span style="color:#a6e22e">String&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;type&amp;#34;&lt;/span>, &lt;span style="color:#a6e22e">status&lt;/span>),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#a6e22e">err&lt;/span> &lt;span style="color:#f92672">!=&lt;/span> &lt;span style="color:#66d9ef">nil&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#66d9ef">nil&lt;/span>, &lt;span style="color:#a6e22e">err&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#a6e22e">v&lt;/span>.(&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">StockAnalysisResult&lt;/span>), &lt;span style="color:#66d9ef">nil&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h2 id="macos-奇怪的安全扫码机制">macOS 奇怪的安全扫码机制&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># 查看最近的 syspolicyd 扫描记录&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>log show --predicate &lt;span style="color:#e6db74">&amp;#39;subsystem == &amp;#34;com.apple.syspolicy.exec&amp;#34;&amp;#39;&lt;/span> --last 5m --style compact | grep performScan
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>System Settings → Privacy &amp;amp; Security → Full Disk Access，给 VS Code 完全磁盘访问权限有效&lt;/code>&lt;/p></description></item><item><title>macOS Tips &amp; Tricks</title><link>https://995facee.rickylin.pages.dev/posts/2025/20250307-macos-tips/</link><pubDate>Fri, 07 Mar 2025 16:05:00 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2025/20250307-macos-tips/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://saurabhs.org/macos-tips" target="_blank" rel="noopener">macOS Tips &amp;amp; Tricks&lt;/a>&lt;/li>
&lt;/ul>
&lt;h3 id="general">General&lt;/h3>
&lt;h4 id="native-ui-conventions">Native UI Conventions&lt;/h4>
&lt;ul>
&lt;li>Press ⇧⌘/ to search all of the current app&amp;rsquo;s menu items. Then use the Up/Down arrow keys to navigate the results and press &lt;code>Return&lt;/code> to execute that menu bar action.&lt;/li>
&lt;li>Press ⌃F2 to move keyboard focus to the application&amp;rsquo;s menu bar. Start typing the first few letters of a menu title to jump to that menu.&lt;/li>
&lt;li>Hold the &lt;code>Option&lt;/code> key while expanding an outline view to recursively expand all children. (The easiest place to test this is in Finder&amp;rsquo;s List view.)&lt;/li>
&lt;li>On modal dialogs/sheets, press &lt;code>Command&lt;/code> + the first letter of the button to press that button. ⌘. is the shortcut equivalent of the &lt;code>Escape&lt;/code> key.&lt;/li>
&lt;li>Hold &lt;code>Control&lt;/code> and &lt;code>Option&lt;/code> while clicking on a window to switch focus to that window without raising it.&lt;/li>
&lt;li>Hold &lt;code>Command&lt;/code> while dragging a toolbar icon to move it to a new position.&lt;/li>
&lt;li>By default, clicking inside a scroll bar will scroll partially towards the clicked location. Hold &lt;code>Option&lt;/code> while clicking in the scroll bar to jump directly to the clicked location.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while dragging the scroller to slowly scroll.&lt;/li>
&lt;li>In a scroll view, use the Up/Down keys to scroll in small increments. Hold &lt;code>Option&lt;/code> to scroll in larger increments, and hold &lt;code>Command&lt;/code> to scroll to the beginning or end.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while pressing the Page Up/Page Down keys to also move the cursor while scrolling.&lt;/li>
&lt;li>In a text field that treats the Tab key as an input, press &lt;code>Control-Tab&lt;/code> and &lt;code>Control-Shift-Tab&lt;/code> to move focus to the previous or next control.&lt;/li>
&lt;li>Press ⌃⌘D while holding the pointer over a word to view an inline dictionary definition of the word.&lt;/li>
&lt;li>Press ⌃F6 to move focus to a floating window.&lt;/li>
&lt;li>To quickly find text, select some text and press ⌘E followed by ⌘G.&lt;/li>
&lt;li>Press ⌃⌫ to delete only the accent mark from the previous character (e.g. é will become e).&lt;/li>
&lt;li>In Fonts windows, enter &lt;code>*X&lt;/code> to scale the current font size, e.g. &lt;code>*1.5&lt;/code>.&lt;/li>
&lt;li>When entering text, press ⌥⇧K (on U.S. keyboards) to insert an Apple logo.&lt;/li>
&lt;li>Hold &lt;code>Command&lt;/code> while dragging a Picture-in-Picture (PiP) video player to move it anywhere without having it snap to one of the screen corners.&lt;/li>
&lt;/ul>
&lt;h4 id="screenshots">Screenshots&lt;/h4>
&lt;ul>
&lt;li>After pressing ⇧⌘4 and while drawing the screen capture area, hold &lt;code>Option&lt;/code> while resizing to resize from the center, and hold &lt;code>Shift&lt;/code> while resizing to adjust only one axis. After drawing the area, hold the Space bar and drag to move the selected area.&lt;/li>
&lt;li>After pressing ⇧⌘4, hold &lt;code>Control&lt;/code> while taking the screenshot to copy to the clipboard instead of saving to file.&lt;/li>
&lt;li>After pressing ⇧⌘4, press the Space bar to select a window to screenshot. Hold down &lt;code>Option&lt;/code> while taking the screenshot to remove the window&amp;rsquo;s shadow.&lt;/li>
&lt;li>Right click on the floating screenshot preview to access additional actions.&lt;/li>
&lt;/ul>
&lt;h4 id="opensave-dialogs">Open/Save Dialogs&lt;/h4>
&lt;ul>
&lt;li>Drag a file or folder from Finder into an open/save dialog to jump directly to that file.&lt;/li>
&lt;li>In save dialogs, press ⌘= to switch between the compact and expanded layout.&lt;/li>
&lt;li>In save dialogs, press ⌘⌫ to activate the Delete button, ⌘D to activate the Don&amp;rsquo;t Save button, and ⌘. (or &lt;code>Esc&lt;/code>) to activate the Cancel button.&lt;/li>
&lt;li>Press &lt;code>~&lt;/code> to open a Go To File dialog prefilled with the home directory. Press &lt;code>/&lt;/code> to open it prefilled with the root directory.&lt;/li>
&lt;li>Press ⌘R to reveal the selected item in Finder.&lt;/li>
&lt;/ul>
&lt;h4 id="mission-control--window-management">Mission Control / Window Management&lt;/h4>
&lt;ul>
&lt;li>When a window is inactive, use the &lt;code>Command&lt;/code> key to interact with it without making it active.&lt;/li>
&lt;li>Hold &lt;code>Control&lt;/code> when pressing the Mission Control function key to only show the current app&amp;rsquo;s windows.
Hold &lt;code>Command&lt;/code> when pressing the Mission Control function key to show the desktop.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while double-clicking a window&amp;rsquo;s corner to expand the window to fill the screen.&lt;/li>
&lt;li>&lt;code>Option&lt;/code>-Click to switch windows while hiding the previous app. &lt;code>Command-Option&lt;/code>-Click to switch windows and hide all other apps.&lt;/li>
&lt;li>In the Command-Tab app switcher, press the Up or Down arrow keys (or the 1 key) on an app to view that app&amp;rsquo;s windows.&lt;/li>
&lt;li>In the Command-Tab app switcher, hold &lt;code>Option&lt;/code> while switching to an app to un-minimize all its windows.&lt;/li>
&lt;li>Press ⌘` to cycle between windows of the foreground application.&lt;/li>
&lt;li>Press ⌃F4 to cycle between windows across all applications in the current desktop space.&lt;/li>
&lt;li>Drag a window to the top of the screen and push it against the top of the screen to enter Mission Control with that window selected.&lt;/li>
&lt;li>Press ⌥⌘W or hold &lt;code>Option&lt;/code> while clicking the red close button, to close &lt;em>all&lt;/em> of the foreground application&amp;rsquo;s open windows.&lt;/li>
&lt;li>Press ⌥⌘M, or hold &lt;code>Option&lt;/code> while clicking the yellow minimize button, to minimize &lt;em>all&lt;/em> of the foreground application&amp;rsquo;s open windows.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while clicking the green zoom button to fill the window to the screen instead of entering full-screen mode.&lt;/li>
&lt;li>When configuring Hot Corners in System Settings, hold any or all of &lt;code>Control&lt;/code>, &lt;code>Option&lt;/code>, &lt;code>Command&lt;/code>, or &lt;code>Shift&lt;/code> to only activate the corner while the selected keys are also held down.&lt;/li>
&lt;li>On a trackpad, use two fingers to double-tap (&lt;em>tap&lt;/em>, not click) on an app&amp;rsquo;s Dock icon to show all of the app&amp;rsquo;s windows. Alternatively, perform the App Exposé trackpad gesture over an app&amp;rsquo;s Dock icon.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while resizing a window to resize from the center of the window.
Hold &lt;code>Shift&lt;/code> while resizing a window to lock the aspect ratio.&lt;/li>
&lt;li>Double-click a window&amp;rsquo;s border to resize that edge to fill the screen. Hold &lt;code>Option&lt;/code> while double-clicking to expand both edges.&lt;/li>
&lt;li>In Mission Control, perform a scroll up over a group of app windows to reveal the individual windows. Press the Space bar while holding the pointer over any window to magnify it.&lt;/li>
&lt;li>In Mission Control, Option-click another desktop space to switch to that space while staying in Mission Control.&lt;/li>
&lt;li>In Mission Control, drag the application icon underneath the windows to move all of an app&amp;rsquo;s windows to another space.&lt;/li>
&lt;li>In Mission Control app window mode, press &lt;code>Tab&lt;/code> and &lt;code>Shift-Tab&lt;/code> to switch applications.&lt;/li>
&lt;li>If a window was minimized in a different space, hold &lt;code>Command&lt;/code> while un-minimizing to restore it to the current space.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while un-minimizing a window to un-minimize all windows from that app.&lt;/li>
&lt;li>If an app has windows in multiple spaces, click the app&amp;rsquo;s Dock icon repeatedly to cycle through the spaces with that app&amp;rsquo;s windows.&lt;/li>
&lt;li>If keyboard shortcuts are enabled for switching desktop spaces, pressing a shortcut while clicking and holding a window will move the window to that space.&lt;/li>
&lt;li>In Stage Manager, hold &lt;code>Shift&lt;/code> while clicking on a window to add that window to the current stage instead of replacing it.&lt;/li>
&lt;/ul>
&lt;h4 id="function-keys">Function Keys&lt;/h4>
&lt;ul>
&lt;li>Hold down &lt;code>Shift&lt;/code> and &lt;code>Option&lt;/code> when changing the volume or brightness to make smaller adjustments.&lt;/li>
&lt;li>Hold down &lt;code>Option&lt;/code> while changing the brightness to quickly open Display settings, or while changing the volume to open Sound settings.&lt;/li>
&lt;li>Hold down &lt;code>Shift&lt;/code> while changing the volume to audibly preview the volume level.&lt;/li>
&lt;li>When connected to an external display, hold down &lt;code>Control&lt;/code> while changing the brightness to adjust the brightness of the non-active display.&lt;/li>
&lt;li>Press and hold down on the Mission Control function key to automatically exit Mission Control after letting go of the key.&lt;/li>
&lt;/ul>
&lt;h4 id="menu-bar--notification-center">Menu Bar / Notification Center&lt;/h4>
&lt;ul>
&lt;li>Hold &lt;code>Option&lt;/code> while opening the Wi-Fi and Bluetooth menus to access extra options.&lt;/li>
&lt;li>Hold &lt;code>Command&lt;/code> while dragging a menu bar icon to move it to a new position.&lt;/li>
&lt;li>Add new menu bar items by dragging icons from Control Center to the menu bar.&lt;/li>
&lt;li>Option-click the date/time in the menu bar to toggle Do Not Disturb.&lt;/li>
&lt;li>Right-click a widget to change its size.&lt;/li>
&lt;li>On a trackpad, swipe horizontally with two fingers over a notification to dismiss that notification.&lt;/li>
&lt;/ul>
&lt;h3 id="finder">Finder&lt;/h3>
&lt;ul>
&lt;li>After copying a file, press ⌥⌘V to move the file instead of pasting a copy of it.&lt;/li>
&lt;li>Press ⌃⌘N with multiple files selected to create a new folder with those items.&lt;/li>
&lt;li>Press &lt;code>Tab&lt;/code> and &lt;code>Shift-Tab&lt;/code> to navigate through files alphabetically, regardless of the current sort ordering (only in Icons and List view).&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while activating Quick Look to immediately launch into full-screen view.&lt;/li>
&lt;li>After opening Quick Look with multiple files selected, press ⌘⏎ to display a grid view of all items. Use the arrow keys to navigate and press Return to select an item to focus on.&lt;/li>
&lt;li>In Quick Look, right-click on the &amp;ldquo;Open with&amp;rdquo; button to select a different app to use to open the file.&lt;/li>
&lt;li>In Columns view, hold &lt;code>Option&lt;/code> while resizing a column to simultaneously resize all columns.&lt;/li>
&lt;li>In Columns view, double-click a column separator to auto-resize that column. Hold &lt;code>Option&lt;/code> while double-clicking on any separator to auto-resize all columns.&lt;/li>
&lt;li>In Columns view, click the empty space at the bottom of a folder to go to the parent folder.&lt;/li>
&lt;li>In Columns view, and when in a deeply nested file, press &lt;code>Shift-Tab&lt;/code> and &lt;code>Tab&lt;/code> to navigate through the parent directories without losing the path to the file.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while dragging a file to make a new copy instead of moving the original. Hold &lt;code>Command&lt;/code> and &lt;code>Option&lt;/code> to create an alias to the file.&lt;/li>
&lt;li>In List view, press ⌘+ and ⌘- to increase and decrease the row size.&lt;/li>
&lt;li>In List view, press ⌥↑ and ⌥↓ to select the top-most and bottom-most item.&lt;/li>
&lt;li>In List view, use the Left and Right arrow keys to collapse and expand directories. When a file is selected, press the Left arrow key to jump to the parent folder.&lt;/li>
&lt;li>Press ⌘I to show the inspector for the current file.
Press ⌥⌘I to show a floating inspector that updates with the selected file.&lt;/li>
&lt;li>Press ⌥⌘C to copy the full pathname of the currently selected file.&lt;/li>
&lt;li>Press ⇧⌘. to toggle showing hidden files.&lt;/li>
&lt;li>Press ⌥⌘⌫ to immediately delete a file without sending it to the Trash.&lt;/li>
&lt;li>Merge folders by holding &lt;code>Option&lt;/code> while dragging one folder on top of another folder.&lt;/li>
&lt;li>Set a custom icon for a folder by copying the new icon, inspecting the folder (⌘I), and pasting the icon by selecting the folder icon in the upper-left of the inspector window and pressing ⌘V.&lt;/li>
&lt;li>Drag selected text into a Finder window to quickly create and save a text clipping. (Text clippings are text files that can&amp;rsquo;t be edited and don&amp;rsquo;t require a filename to be saved.)&lt;/li>
&lt;li>Press ⌥⌘O to open the selected file &lt;em>and&lt;/em> automatically close the Finder window.&lt;/li>
&lt;li>Press ⌥⇧⌘V to paste an item while preserving the file permission flags.&lt;/li>
&lt;li>Hold &lt;code>Command&lt;/code> while dragging an icon in Icon view to align it to a grid.&lt;/li>
&lt;li>Restart Finder by holding &lt;code>Option&lt;/code> while right-clicking the Finder dock icon and selecting Relaunch.&lt;/li>
&lt;li>Drag a folder to the new tab button (only visible if multiple tabs are already open) to open the folder in a new tab.&lt;/li>
&lt;li>Press ⌃⌘↑ to open the parent folder in a new window.&lt;/li>
&lt;li>If the toolbar is hidden (⌥⌘T), Finder will open folders in a new window.&lt;/li>
&lt;li>Press ⌘R with an image selected to rotate it clockwise, and ⌘L to rotate it counter-clockwise.&lt;/li>
&lt;/ul>
&lt;h3 id="dock">Dock&lt;/h3>
&lt;ul>
&lt;li>Press ⌥⌘D to hide and show the dock.&lt;/li>
&lt;li>Press ⌃F3 to move keyboard focus to the Dock. Then use the Left and Right arrow keys to select an app, or type the first few letters of an app. Press &lt;code>Enter&lt;/code> to open the selected app, or press the Up arrow key to open the app&amp;rsquo;s menu.&lt;/li>
&lt;li>Hold &lt;code>Control&lt;/code> and &lt;code>Shift&lt;/code> while mousing over the Dock to temporarily turn on magnification.&lt;/li>
&lt;li>Quickly move the Dock to a different side of the screen by holding &lt;code>Shift&lt;/code> while dragging the resize handle.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while resizing the Dock to resize in multiples of 16 points.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> and &lt;code>Command&lt;/code> while clicking a running app&amp;rsquo;s Dock icon to hide all other applications.&lt;/li>
&lt;li>Open a file in a specific application by dragging the file to the application&amp;rsquo;s Dock icon. If the application doesn&amp;rsquo;t accept the file type by default, force open the file by holding &lt;code>Option&lt;/code> and &lt;code>Command&lt;/code> while dragging the file.&lt;/li>
&lt;li>If a dock icon is bouncing repeatedly, stop the bouncing by mousing over the icon.&lt;/li>
&lt;li>Hold &lt;code>Control&lt;/code> and &lt;code>Command&lt;/code> when right-clicking a Dock icon to only see the default system menu options.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> and &lt;code>Command&lt;/code> when clicking on a folder in the Dock to open the folder in a new Finder window.&lt;/li>
&lt;li>To open multiple items from a stack, hold &lt;code>Option&lt;/code> while selecting an item to open it in the background while keeping the stack open.&lt;/li>
&lt;li>After opening a stack, hover the cursor over an item and press the Space bar to preview the item with quick look.&lt;/li>
&lt;li>Right-click the Launchpad dock icon to open an app from an inline menu.&lt;/li>
&lt;li>In Launchpad, hold &lt;code>Option&lt;/code> to enter &amp;ldquo;jiggle mode&amp;rdquo; to re-arrange and delete apps.&lt;/li>
&lt;li>To add AirDrop to the Dock, navigate to &lt;code>/System/Library/CoreServices/Finder.app/Contents/Applications&lt;/code> in Finder and drag the AirDrop icon to the Dock.&lt;/li>
&lt;/ul>
&lt;h3 id="spotlight">Spotlight&lt;/h3>
&lt;ul>
&lt;li>Press ⌘B to search the web for the current query.&lt;/li>
&lt;li>Press ⌘C to copy the full path to the selected file, or to copy the result of the current calculation.&lt;/li>
&lt;li>Press ⌘D to open the Dictionary app with the current query.&lt;/li>
&lt;li>Press ⌘L to jump to the dictionary section in the results (if present).&lt;/li>
&lt;li>Press ⌘⏎ or ⌘R to reveal the selected file in Finder.&lt;/li>
&lt;li>Use the &lt;code>name:&lt;/code> filter to only search in the filename.&lt;/li>
&lt;li>Add &lt;code>kind:folder&lt;/code> to only search for folder names.&lt;/li>
&lt;li>Hold &lt;code>Command&lt;/code> to show the path to the currently selected file.&lt;/li>
&lt;/ul>
&lt;h3 id="safari">Safari&lt;/h3>
&lt;ul>
&lt;li>Tab groups organize tabs spatially. Use ⌥⌘{↑,↓,←,→} to navigate tabs in 2D space.&lt;/li>
&lt;li>When a video is playing, right click the speaker icon in the address bar or tab to enter Picture-in-Picture (PiP) mode.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while closing a tab to close all other tabs &lt;em>except&lt;/em> the current tab.&lt;/li>
&lt;li>Click and hold the back button to see recent browsing history. Hold &lt;code>Option&lt;/code> to see page URLs instead of page titles.&lt;/li>
&lt;li>Drag selected text onto the Safari dock icon to quickly search the web for that text.&lt;/li>
&lt;li>Press ⇧⌘T to re-open the most recently closed tab or window.&lt;/li>
&lt;li>Click and hold on the new tab icon in the toolbar to view recently closed tabs.&lt;/li>
&lt;li>Press the Space bar at the beginning of the address bar to change the search engine and to see recent web searches.&lt;/li>
&lt;li>Add &lt;code>kind:bookmark&lt;/code> to Spotlight searches to search Safari bookmarks and browsing history.&lt;/li>
&lt;li>&lt;code>Shift&lt;/code>-click a link to add it to Reading List.&lt;/li>
&lt;li>Click and hold a bookmark in the bookmarks bar to edit its display title.&lt;/li>
&lt;li>Option-click the reload icon or press ⌥⌘R to force a fresh reload of the current webpage.&lt;/li>
&lt;li>Right-click the reader icon in the address bar to automatically turn on Reader Mode for all pages on the current website.&lt;/li>
&lt;li>After performing a web search and opening a result in the same tab, press ⌥⌘S to go back to the search results page.&lt;/li>
&lt;li>Press ⇧⌘I to create a new email message with the contents of the current page.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> over the History &amp;gt; Clear History menu item to only clear browsing history while preserving website data.&lt;/li>
&lt;li>Press ⌃⌘D while hovering over a link to open an inline preview of the link.&lt;/li>
&lt;/ul>
&lt;h3 id="mail">Mail&lt;/h3>
&lt;ul>
&lt;li>&lt;code>Command&lt;/code>-click multiple mailboxes in the left sidebar to simultaneously view all messages from the selected mailboxes.&lt;/li>
&lt;li>Select part of a message&amp;rsquo;s text before replying or forwarding to only include the selected text in the new message.&lt;/li>
&lt;li>Drag a file to the Mail dock icon to compose a new message with the file already attached.&lt;/li>
&lt;li>Press ⌥⇧⌘N to create a new tab.&lt;/li>
&lt;li>Press the Space bar at the end of a message to go to the next message. Hold &lt;code>Shift&lt;/code> while pressing the Space bar at the top of a message to go to the previous message.&lt;/li>
&lt;li>Start typing the first few characters of the sender, subject, or body to jump to that message in the messages list.&lt;/li>
&lt;li>Press ⌥⌘↑ and ⌥⌘↓ to jump to the top-most or bottom-most message in the messages list.&lt;/li>
&lt;li>Save an extra copy of an important message by dragging it to the Finder.&lt;/li>
&lt;li>If a message bounces, use &lt;code>Message &amp;gt; Send Again&lt;/code> on the bounced message to re-send it to a different address.&lt;/li>
&lt;li>To add a message to multiple folders, hold Command while dragging the message to each folder.&lt;/li>
&lt;li>Press ⇧⌘C to assign a color to a message.&lt;/li>
&lt;li>Drag a message into the Notes or Reminders app to add a link to the message.&lt;/li>
&lt;li>Press ⌘R and ⇧⌘R while replying to a message to switch between reply and reply-all.&lt;/li>
&lt;li>Press ⌥⌫ to delete a message without automatically opening the next message.&lt;/li>
&lt;li>&lt;code>Command&lt;/code>-click on the currently selected message to unselect it.&lt;/li>
&lt;li>If a message has already been replied to, click on the reply icon in the message list to open the reply in a new window.&lt;/li>
&lt;li>When creating a new mailbox, add a forward slash to create a nested mailbox.&lt;/li>
&lt;li>After performing a search, select a mailbox from the left sidebar to filter the search to that mailbox.&lt;/li>
&lt;li>Hold &lt;code>Shift&lt;/code> while launching Mail to reset the index.&lt;/li>
&lt;/ul>
&lt;h3 id="preview">Preview&lt;/h3>
&lt;ul>
&lt;li>Press ` to bring up a magnifier, and then press &lt;code>+&lt;/code> and &lt;code>-&lt;/code> to resize it.&lt;/li>
&lt;li>In a PDF document, re-order the pages in the document by re-ordering the pages in the sidebar.&lt;/li>
&lt;li>Merge two PDF documents by dragging pages from one document&amp;rsquo;s sidebar to the other document&amp;rsquo;s sidebar.&lt;/li>
&lt;li>In the save dialog for an image, hold &lt;code>Option&lt;/code> while opening the Format menu to access an extended list of formats.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> and the Space bar to activate the pan tool.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while in text selection mode to switch to rectangular text selection.&lt;/li>
&lt;/ul>
&lt;h3 id="calendar">Calendar&lt;/h3>
&lt;ul>
&lt;li>Hold &lt;code>Shift&lt;/code> while dragging an event to set a more precise time instead of snapping to 15-minute intervals.&lt;/li>
&lt;li>Click and hold the &lt;code>Accept&lt;/code> button in a calendar invite to change which calendar the event is accepted to.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while pressing the &lt;code>Accept&lt;/code> button in a calendar invite to accept all events.&lt;/li>
&lt;li>Hold &lt;code>Command&lt;/code> while clicking any calendar&amp;rsquo;s checkbox in the left sidebar to show or hide all calendars.&lt;/li>
&lt;li>Hold &lt;code>Command&lt;/code> and &lt;code>Option&lt;/code> while clicking a calendar&amp;rsquo;s checkbox to only show that calendar.&lt;/li>
&lt;li>Add &lt;code>kind:event&lt;/code> to Spotlight searches to search calendar events.&lt;/li>
&lt;li>Resize the mini-calendar in the bottom-left to preview more months.&lt;/li>
&lt;li>With an event selected, press ⌃⌥↑ and ⌃⌥↓ to adjust the time of the event. This also works with multiple events selected.&lt;/li>
&lt;li>In Week view, press ⌥⌘← and ⌥⌘→ to shift the view by a single day.&lt;/li>
&lt;/ul>
&lt;h3 id="messages">Messages&lt;/h3>
&lt;ul>
&lt;li>Press ⌘R to directly reply to the latest message in the conversation.
Press ⇧⌘R to reply to the latest thread in the conversation.&lt;/li>
&lt;li>Press ⌘T to bring up the tapback selector for the latest message. Use the 1-6 number keys to select a reaction.&lt;/li>
&lt;li>Press ⌘E to edit the latest sent message.&lt;/li>
&lt;li>Press ⌥↑ and ⌥↓ in the message input field to cycle through previously sent messages.&lt;/li>
&lt;li>Press ⌘1-9 to jump to a pinned conversation.&lt;/li>
&lt;li>Right-click on a message and select Show Times to view exact timestamps for each message.&lt;/li>
&lt;li>Right-click the Messages icon in the Dock to quickly view and jump to unread conversations.&lt;/li>
&lt;/ul>
&lt;h3 id="photos">Photos&lt;/h3>
&lt;ul>
&lt;li>Drag an item to the &amp;ldquo;My Albums&amp;rdquo; header section to quickly create an album with that item.&lt;/li>
&lt;li>After adding an item to an album, use ⌃⌘A to add other items to that same album.&lt;/li>
&lt;li>When editing an image, hold down the &lt;code>M&lt;/code> key to compare the modifications to the original.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while launching Photos to choose a different photo library to open.&lt;/li>
&lt;li>Drag a photo from the Photos app into a Finder window to quickly export the photo, or into the Mail or Messages app to attach the photo.&lt;/li>
&lt;li>When editing an image, double-click an adjustment slider to reset it.&lt;/li>
&lt;li>When editing an image, hold &lt;code>Option&lt;/code> while holding the pointer over an adjustment slider to extend the adjustment range.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while clicking the rotate button to reverse the rotation direction.&lt;/li>
&lt;li>Hold &lt;code>Shift&lt;/code> while cropping a photo to maintain the current aspect ratio, and hold &lt;code>Option&lt;/code> to crop from the center of the photo.&lt;/li>
&lt;/ul>
&lt;h3 id="textedit">TextEdit&lt;/h3>
&lt;ul>
&lt;li>In rich text mode, press &lt;code>Option-Tab&lt;/code> to insert an outlined list.&lt;/li>
&lt;li>Press &lt;code>Option-Escape&lt;/code> to autocomplete the current word.&lt;/li>
&lt;li>Press ⌃⌥⌘P in the find text field (⌘F) to access special search tokens.&lt;/li>
&lt;li>Hold &lt;code>Option&lt;/code> while selecting text to make vertical text selections.&lt;/li>
&lt;li>The select line dialog (⌘L) supports the following formats:
&lt;code>1-3&lt;/code> selects lines 1-3 in the document
&lt;code>+2&lt;/code> selects the 2nd line below the cursor
&lt;code>-2&lt;/code> selects the 2nd line above the cursor
&lt;code>+2-4&lt;/code> selects 3 lines, starting from 2 lines below the cursor
&lt;code>-2-4&lt;/code> selects 3 lines, starting from 2 lines above the cursor&lt;/li>
&lt;/ul>
&lt;h3 id="terminal">Terminal&lt;/h3>
&lt;ul>
&lt;li>Press ⇧⌘A to select the output from the previous command.&lt;/li>
&lt;li>Press ⌘L to clear the output from the previous command.&lt;/li>
&lt;li>Press ⌃⌘V to paste and format text that is properly escaped for the shell.&lt;/li>
&lt;li>Press ⌃T while a command is executing to view runtime statistics about the execution so far.&lt;/li>
&lt;li>Press ⌘{↑,↓} to select the previous/next commands. Then press ⇧⌘A to select the output of the currently selected command.&lt;/li>
&lt;li>Press ⇧⌘I to set a title for the current window and tab.&lt;/li>
&lt;li>Drag a file or folder into a Terminal window to insert its full path. Alternatively, copy a file or folder in Finder and paste it in Terminal to insert its path.&lt;/li>
&lt;/ul>
&lt;h3 id="calculator">Calculator&lt;/h3>
&lt;ul>
&lt;li>Press ⌘T to open a new window that keeps a running history of calculations.&lt;/li>
&lt;li>Press ⌘R to enable Reverse Polish notation (RPN) mode.&lt;/li>
&lt;li>Press &lt;code>p&lt;/code> to insert pi.&lt;/li>
&lt;li>Right-click the number display and select &amp;ldquo;Large Type&amp;rdquo; to view the current result in a large overlay window.&lt;/li>
&lt;li>Use the Convert menu to perform various unit conversions.&lt;/li>
&lt;li>In Programmer view (⌘3), click the individual binary bits to toggle between 0 and 1.&lt;/li>
&lt;/ul>
&lt;h3 id="quicktime-player">QuickTime Player&lt;/h3>
&lt;ul>
&lt;li>Grab a single frame from a video by pausing on the desired frame (using the Left and Right arrow keys to navigate individual frames) and pressing ⌘C.&lt;/li>
&lt;/ul>
&lt;h3 id="photo-booth">Photo Booth&lt;/h3>
&lt;ul>
&lt;li>Hold &lt;code>Option&lt;/code> while taking a picture to skip the countdown.&lt;/li>
&lt;li>Hold &lt;code>Shift&lt;/code> while taking a picture to disable the screen flash.&lt;/li>
&lt;li>When choosing one of the distortion effects (on the third page), click and drag the cursor on the image preview to change the effects origin.&lt;/li>
&lt;/ul></description></item><item><title>Mac Niche App Recommendations and Workflow Share (2024)</title><link>https://995facee.rickylin.pages.dev/posts/2024/20241114-mac-app-share/</link><pubDate>Thu, 14 Nov 2024 09:52:00 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2024/20241114-mac-app-share/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://blog.ursb.me/posts/mac-app-share-2024/" target="_blank" rel="noopener">Mac Niche App Recommendations and Workflow Share (2024)&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Objective-See: An Open Source Project Org for Apple Privacy and Security</title><link>https://995facee.rickylin.pages.dev/posts/2024/20241113-objective-see/</link><pubDate>Wed, 13 Nov 2024 09:44:00 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2024/20241113-objective-see/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://t.me/misakatech/1349" target="_blank" rel="noopener">Objective-See: An Open Source Project Org for Apple Privacy and Security&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>While searching for small tools today, I found they have built a bunch of open-source software for macOS, mostly related to privacy and security.&lt;/p>
&lt;ul>
&lt;li>
&lt;p>&lt;a href="https://objective-see.org/products/knockknock.html" target="_blank" rel="noopener">KnockKnock&lt;/a>: See what background processes, daemons, launch items, kernel extensions, login items, browser plugins, and more are on your Mac. Much more detailed than &amp;ldquo;Login Items&amp;rdquo; (some software auto-starts in other ways).&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://objective-see.org/products/lulu.html" target="_blank" rel="noopener">LuLu&lt;/a>: An open-source macOS network firewall that lets you control each application&amp;rsquo;s network connections in detail (similar to Hands Off!).&lt;/p></description></item><item><title>Advanced macOS Command-Line Tools</title><link>https://995facee.rickylin.pages.dev/posts/2024/20241113-advanced-macos-commands/</link><pubDate>Wed, 13 Nov 2024 09:14:26 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2024/20241113-advanced-macos-commands/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://saurabhs.org/advanced-macos-commands" target="_blank" rel="noopener">Advanced macOS Command-Line Tools&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://weiyen.net/articles/useful-macos-cmd-line-utilities/" target="_blank" rel="noopener">Useful built-in macOS command-line utilities&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://catcoding.me/p/apple-perf/" target="_blank" rel="noopener">苹果：为了安全让 M2 吃灰&lt;/a>&lt;/li>
&lt;/ul>
&lt;h4 id="sips---image-manipulation">sips - image manipulation&lt;/h4>
&lt;p>&lt;code>sips -z &amp;lt;height&amp;gt; &amp;lt;width&amp;gt; &amp;lt;image&amp;gt;&lt;/code> resizes the specified image, ignoring the previous aspect ratio.&lt;/p>
&lt;p>&lt;code>sips -Z &amp;lt;size&amp;gt; &amp;lt;image&amp;gt;&lt;/code> resizes the largest side of the specified image, preserving the aspect ratio.&lt;/p>
&lt;p>&lt;code>sips -c &amp;lt;height&amp;gt; &amp;lt;width&amp;gt; &amp;lt;image&amp;gt;&lt;/code> crops the specified image to the given dimensions (relative to the center of the original image).&lt;/p>
&lt;p>&lt;code>sips -r &amp;lt;degrees&amp;gt; &amp;lt;image&amp;gt;&lt;/code> rotates the image by the specified degrees.&lt;/p></description></item><item><title>Create macOS DMG and Bootable ISO</title><link>https://995facee.rickylin.pages.dev/posts/2023/20230612-macos-dmg-iso/</link><pubDate>Mon, 12 Jun 2023 10:04:20 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2023/20230612-macos-dmg-iso/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://www.newlearner.site/2019/03/07/macos-dmg-iso.html" target="_blank" rel="noopener">Create macOS DMG and Bootable ISO&lt;/a>&lt;/li>
&lt;/ul>
&lt;h3 id="dmg">dmg&lt;/h3>
&lt;ol>
&lt;li>AppStore ==&amp;gt; search &amp;lsquo;install macos&amp;rsquo; ==&amp;gt; get installer ==&amp;gt; &lt;code>du -sh /Applications/Install\ macOS\ Mojave.app/&lt;/code>&lt;/li>
&lt;li>Disk Utility ==&amp;gt; File ==&amp;gt; New Image ==&amp;gt; Blank Image
&lt;ol>
&lt;li>Size: installer size&lt;/li>
&lt;li>Format: Mac OS Extended (Journaled)&lt;/li>
&lt;li>Partition: Single partition - GUID Partition Map&lt;/li>
&lt;li>Image Format: read/write disk image&lt;/li>
&lt;li>same as &lt;code>hdiutil create -o ~/Desktop/macOS\ Mojave -size 6500m -layout SPUD -fs HFS+J&lt;/code>&lt;/li>
&lt;/ol>
&lt;/li>
&lt;li>&lt;code>sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/macOS\ Mojave&lt;/code>&lt;/li>
&lt;/ol>
&lt;h3 id="iso">iso&lt;/h3>
&lt;ol>
&lt;li>&lt;code>hdiutil convert ~/Desktop/macOS\ Mojave.dmg -format UDTO -o ~/Desktop/macOS\ Mojave.iso&lt;/code>&lt;/li>
&lt;li>&lt;code>mv ~/Desktop/macOS\ Mojave.iso.cdr ~/Desktop/macOS\ Mojave.iso&lt;/code>&lt;/li>
&lt;/ol></description></item><item><title>My Productivity Mac Settings and Apps</title><link>https://995facee.rickylin.pages.dev/posts/2023/20230420-my-mac-setting/</link><pubDate>Thu, 20 Apr 2023 14:52:08 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2023/20230420-my-mac-setting/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://jason-memo.dev/posts/my-mac-setting/" target="_blank" rel="noopener">My Productivity Mac Settings and Apps&lt;/a>&lt;/li>
&lt;/ul>
&lt;h3 id="control-dark-mode-per-app">Control dark mode per app&lt;/h3>
&lt;blockquote>
&lt;p>&lt;a href="https://nightowlapp.co/" target="_blank" rel="noopener">https://nightowlapp.co/&lt;/a>&lt;/p>&lt;/blockquote>
&lt;p>&lt;code>brew install --cask nightowl&lt;/code>&lt;/p>
&lt;h3 id="control-external-monitor-brightness-with-the-keyboard---monitorcontrol">Control external monitor brightness with the keyboard - MonitorControl&lt;/h3>
&lt;blockquote>
&lt;p>&lt;a href="https://github.com/MonitorControl/MonitorControl" target="_blank" rel="noopener">https://github.com/MonitorControl/MonitorControl&lt;/a>&lt;/p>&lt;/blockquote>
&lt;p>&lt;code>brew install --cask monitorcontrol&lt;/code>&lt;/p>
&lt;h3 id="raycast">Raycast&lt;/h3>
&lt;p>Raycast is a free and more powerful Alfred. You can do most things with the keyboard and quickly launch features with Option + Space. It includes many features that other apps charge for.&lt;/p>
&lt;ul>
&lt;li>Launch apps quickly&lt;/li>
&lt;li>Quick dictionary lookup and calculator&lt;/li>
&lt;li>Built-in clipboard history search&lt;/li>
&lt;li>Window management like Magnet, with shortcuts to resize and move windows&lt;/li>
&lt;li>Calendar integration: quickly open Google Meet with the correct account when a meeting starts&lt;/li>
&lt;li>Write shell/nodejs/applescript to bind shortcuts for quick actions&lt;/li>
&lt;li>Rich extension store&lt;/li>
&lt;/ul>
&lt;blockquote>
&lt;p>&lt;a href="https://www.raycast.com/" target="_blank" rel="noopener">https://www.raycast.com/&lt;/a>&lt;/p></description></item><item><title>Inspecting Web Views in macOS</title><link>https://995facee.rickylin.pages.dev/posts/2022/20221202-inspecting-web-views-in-macos/</link><pubDate>Fri, 02 Dec 2022 13:51:24 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2022/20221202-inspecting-web-views-in-macos/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://blog.jim-nielsen.com/2022/inspecting-web-views-in-macos/" target="_blank" rel="noopener">Inspecting Web Views in macOS&lt;/a>&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>defaults write -g WebKitDeveloperExtras -bool YES
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Let Zsh read macOS system proxy settings and set env vars</title><link>https://995facee.rickylin.pages.dev/posts/2021/20210111-macos-auto-read-proxy-settings-zsh/</link><pubDate>Mon, 11 Jan 2021 14:50:11 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2021/20210111-macos-auto-read-proxy-settings-zsh/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://blog.skk.moe/post/macos-auto-read-proxy-settings-zsh/" target="_blank" rel="noopener">Let Zsh read macOS system proxy settings and set env vars&lt;/a>&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-zsh" data-lang="zsh">&lt;span style="display:flex;">&lt;span>$ system_profiler SPNetworkDataType &lt;span style="color:#75715e"># get full network configuration&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ networksetup -listallnetworkservices &lt;span style="color:#75715e"># list all network services&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ networksetup -getwebproxy Wi-Fi &lt;span style="color:#75715e"># get system proxy settings for a specific service&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ scutil --proxy &lt;span style="color:#75715e"># get enabled proxy settings (wrapper for system_profiler)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Set SSLKEYLOGFILE on MacBook to decrypt HTTPS traffic</title><link>https://995facee.rickylin.pages.dev/posts/2020/20201106-sslkeylog/</link><pubDate>Fri, 06 Nov 2020 20:02:54 +0800</pubDate><guid>https://995facee.rickylin.pages.dev/posts/2020/20201106-sslkeylog/</guid><description>&lt;ul>
&lt;li>&lt;a href="http://www.luwenpeng.cn/2020/04/29/MacBook%E8%AE%BE%E7%BD%AESSLKEYLOGFILE%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E8%A7%A3%E5%AF%86HTTPS%E6%B5%81%E9%87%8F/" target="_blank" rel="noopener">Set SSLKEYLOGFILE on MacBook to decrypt HTTPS traffic&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>Create keylogfile&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>mkdir ~/sslkeylogfile &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> touch ~/sslkeylogfile/keylogfile.log &lt;span style="color:#75715e"># create keylogfile.log&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo chmod &lt;span style="color:#ae81ff">777&lt;/span> ~/sslkeylogfile/keylogfile.log &lt;span style="color:#75715e"># change permissions so Chrome can write on startup&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Configure environment variable&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>vim ~/.zshrc &lt;span style="color:#75715e"># open config file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export SSLKEYLOGFILE&lt;span style="color:#f92672">=&lt;/span>~/sslkeylogfile/keylogfile.log &lt;span style="color:#75715e"># set environment variable&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>source ~/.zshrc &lt;span style="color:#75715e"># reload config&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Configure Wireshark&lt;/p>
&lt;p>preferences -&amp;gt; Protocols -&amp;gt; TLS&lt;/p>
&lt;ul>
&lt;li>Set TLS debug file to record decryption logs&lt;/li>
&lt;li>Set (Pre)-Master-Secret log filename to the absolute path of keylogfile.log&lt;/li>
&lt;/ul>
&lt;p>Start Chrome from terminal&lt;/p></description></item></channel></rss>