Home Page on SWangNice http://localhost:1313/ Recent content in Home Page on SWangNice Hugo -- gohugo.io en © 2025 SWang Fri, 20 Sep 2024 04:17:50 +0000 TODO List http://localhost:1313/projects/self_host/stock_bot/01_todo/ Fri, 20 Sep 2024 04:17:50 +0000 http://localhost:1313/projects/self_host/stock_bot/01_todo/ <h2 class="relative group">Short-term TODO <div id="short-term-todo" class="anchor"></div> <span class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100"> <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#short-term-todo" aria-label="Anchor">#</a> </span> </h2> <ul> <li>🚧 The Initial Policy implement (Parameterizing transaction variables)</li> <li>⬜️ The evaluate &amp; logger script</li> <li>⬜ The automatic scripts with Email Sender deployed on the Server</li> <li>⬜ Web UI, will not be too complex just a simple one to synchronous my account for customized policy</li> <li>⬜️ Implement RL algorithms</li> </ul> Website Setup http://localhost:1313/projects/self_host/mac_mini_m4/01_website_hosting/ Fri, 20 Sep 2024 04:17:50 +0000 http://localhost:1313/projects/self_host/mac_mini_m4/01_website_hosting/ <p>I don&rsquo;t have a public IP, so my solution is SSH tunnel + reverse Proxy on cloud server.</p> <h2 class="relative group">🍎Mac Mini Side <div id="mac-mini-side" class="anchor"></div> <span class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100"> <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#mac-mini-side" aria-label="Anchor">#</a> </span> </h2> <p>As a server, my Mac won&rsquo;t sleep, so change the setting firstly.</p> <pre tabindex="0"><code>sudo systemsetup -setcomputersleep Never # never sleep sudo systemsetup -setdisplaysleep 10 # display will sleep in 10 min </code></pre><p>Use autossh to avoid timeout:</p> <pre tabindex="0"><code>brew install autossh </code></pre><p>Add the configuration below in <code>~/.ssh/config</code>, Mac Mini will send package per 30 seconds to keep the connection alive.</p> NAS: Network Attachment Storage http://localhost:1313/projects/self_host/mac_mini_m4/02_nas/ Fri, 20 Sep 2024 04:17:50 +0000 http://localhost:1313/projects/self_host/mac_mini_m4/02_nas/ <h2 class="relative group">Hardware <div id="hardware" class="anchor"></div> <span class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100"> <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#hardware" aria-label="Anchor">#</a> </span> </h2> <p>I went with the UNITEK 3373BBK for one of my drive enclosures—and honestly, it wasn’t the best decision.</p> <p>The first big letdown? The bandwidth tops out at just 5Gbps. That’s fine for basic tasks, but definitely underwhelming if you’re dealing with high-speed storage or large file transfers.</p> <p>Even worse, it doesn’t support S.M.A.R.T passthrough, which makes monitoring drive health a hassle. That was a big deal-breaker for me.</p> Showcases http://localhost:1313/projects/self_host/stock_bot/02_results/ Fri, 20 Sep 2024 04:17:50 +0000 http://localhost:1313/projects/self_host/stock_bot/02_results/ <p>This section will feature occasional showcases of my technical achievements—focused purely on the engineering side, not the income.</p> My Own Code Vault: Gitea on Mac Mini http://localhost:1313/projects/self_host/mac_mini_m4/03_gitea/ Fri, 20 Sep 2024 04:17:50 +0000 http://localhost:1313/projects/self_host/mac_mini_m4/03_gitea/ <p>Install dependence of gitea:</p> <pre tabindex="0"><code>brew install git brew install gitea </code></pre> <h2 class="relative group">The database <div id="the-database" class="anchor"></div> <span class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100"> <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#the-database" aria-label="Anchor">#</a> </span> </h2> <p>Install MySQL:</p> <pre tabindex="0"><code>brew install mysql brew services start mysql </code></pre><p>Login MySQL and create the database and user:</p> <pre tabindex="0"><code>mysql -u root </code></pre><p>Then, execute:</p> <pre tabindex="0"><code>CREATE DATABASE gitea CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; CREATE USER &#39;gitea&#39;@&#39;localhost&#39; IDENTIFIED BY &#39;&lt;yourpassword&gt;&#39;; GRANT ALL PRIVILEGES ON gitea.* TO &#39;gitea&#39;@&#39;localhost&#39;; FLUSH PRIVILEGES; </code></pre> <h2 class="relative group">Config the Gitea <div id="config-the-gitea" class="anchor"></div> <span class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100"> <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#config-the-gitea" aria-label="Anchor">#</a> </span> </h2> <p>Start the configuration page of Gitea:</p> MCU Benchmark http://localhost:1313/projects/self_host/mac_mini_m4/04_mcu_markbench/ Fri, 20 Sep 2024 04:17:50 +0000 http://localhost:1313/projects/self_host/mac_mini_m4/04_mcu_markbench/ <a id="gitea-557b8590fb1ca3d7d5e6d0761887bbe0" target="_blank" href="https://code.swangnice.cn/swangnice/mcu-benchmark" class="cursor-pointer"> <div class="w-full md:w-auto pt-3 p-5 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl"> <div class="flex items-center"> <span class="text-2xl text-neutral-800 dark:text-neutral" style="margin-right:10px;"> <span class="relative block icon"> <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="5.67 143.05 628.65 387.55"><path fill="currentColor" d="M115.912 143.075c-6.462 0-13.762.525-22.012 2.325-8.7 1.8-33.5 7.4-53.8 26.9C-4.9 212.4 6.6 276.2 8 285.8c1.7 11.7 6.9 44.2 31.7 72.5 45.8 56.1 144.4 54.8 144.4 54.8s12.1 28.9 30.6 55.5c25 33.1 50.7 58.9 75.7 62 63 0 188.9-.1 188.9-.1s12 .1 28.3-10.3c14-8.5 26.5-23.4 26.5-23.4S547 483 565 451.5c5.5-9.7 10.1-19.1 14.1-28 0 0 55.2-117.1 55.2-231.1-1.1-34.5-9.6-40.6-11.6-42.6-4.1-4.1-9.6-4-9.6-4s-117.2 6.6-177.9 8c-13.267.3-26.433.597-39.5.697l.1 117.002s57.4 24.202 83.1 40.102c3.7 2.3 10.2 6.798 12.9 14.398 2.1 6.1 2 13.101-1 19.301l-61 126.9c-6.2 12.7-21.4 18.1-33.9 12l-126.9-61c-12.5-6-17.9-21.2-11.8-33.8l61-126.9c6-12.5 21.2-17.9 33.8-11.8a5290.322 5290.322 0 0 0 27 12.954c0-36.449-.1-109.053-.1-109.053-29 .4-89.2-2.201-89.2-2.201s-141.4-7.1-156.8-8.5c-4.9-.3-10.525-.825-16.988-.825zm12.188 48.026s7.1 59.399 15.7 94.199c7.2 29.2 24.8 77.7 24.8 77.7s-26.1-3.1-43-9.1c-25.9-8.5-36.9-18.7-36.9-18.7S69.6 321.8 60 295.4c-16.5-44.2-1.4-71.2-1.4-71.2s8.4-22.5 38.5-30c13.8-3.7 31-3.1 31-3.1z"/><path fill="currentColor" d="M326.8 380.1c-8.2.1-15.4 5.8-17.3 13.8-1.9 8 2 16.3 9.1 20 7.7 4 17.5 1.8 22.7-5.4 5.1-7.1 4.3-16.9-1.8-23.1l24-49.1c1.5.1 3.7.2 6.2-.5 4.1-.9 7.1-3.6 7.1-3.6 4.2 1.8 8.6 3.8 13.2 6.1 4.8 2.4 9.3 4.9 13.4 7.3.9.5 1.8 1.1 2.8 1.9 1.6 1.3 3.4 3.1 4.7 5.5 1.9 5.5-1.9 14.9-1.9 14.9-2.3 7.6-18.4 40.6-18.4 40.6-8.1-.2-15.3 5-17.7 12.5-2.6 8.1 1.1 17.3 8.9 21.3 7.8 4 17.4 1.7 22.5-5.3 5-6.8 4.6-16.3-1.1-22.6 1.9-3.7 3.7-7.4 5.6-11.3 5-10.4 13.5-30.4 13.5-30.4.9-1.7 5.7-10.3 2.7-21.3-2.5-11.4-12.6-16.7-12.6-16.7-12.2-7.9-29.2-15.2-29.2-15.2s0-4.1-1.1-7.1c-1.1-3.1-2.8-5.1-3.9-6.3 4.7-9.7 9.4-19.3 14.1-29-4.1-2-8.1-4-12.2-6.1-4.8 9.8-9.7 19.7-14.5 29.5-6.7-.1-12.9 3.5-16.1 9.4-3.4 6.3-2.7 14.1 1.9 19.8l-24.6 50.4z"/></svg> </span> </span> <div id="gitea-557b8590fb1ca3d7d5e6d0761887bbe0-full_name" class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"> swangnice/mcu-benchmark </div> </div> <p id="gitea-557b8590fb1ca3d7d5e6d0761887bbe0-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-neutral"> A markbench of MCUs to help to you choose the right one. </p> My Own PDF Shelf: pdfding on Mac Mini http://localhost:1313/projects/self_host/mac_mini_m4/05_pdf_shelf/ Fri, 20 Sep 2024 04:17:50 +0000 http://localhost:1313/projects/self_host/mac_mini_m4/05_pdf_shelf/ <p>PDFding is a self-hosted PDF library management system, which is perfect for managing my personal PDF collection. It allows me to organize, search, and read PDFs directly from my Mac Mini. Later, I will list a contents of my PDF library, if you need any of them, just email me. No commercial use, please.</p> <h2 class="relative group">Install Docker and Prepare Directories <div id="install-docker-and-prepare-directories" class="anchor"></div> <span class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100"> <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#install-docker-and-prepare-directories" aria-label="Anchor">#</a> </span> </h2> <p>Download <a href="https://www.docker.com/products/docker-desktop/" target="_blank">Docker Desktop</a>, and install it.</p> My Own Photo Server: Immich on Mac Mini http://localhost:1313/projects/self_host/mac_mini_m4/06_photo_server/ Fri, 20 Sep 2024 04:17:50 +0000 http://localhost:1313/projects/self_host/mac_mini_m4/06_photo_server/ <p>Immich is a self-hosted photo and video management solution that allows you to organize, share, and access your media files from anywhere. It provides features like automatic backups, facial recognition, and easy sharing options.</p> <h2 class="relative group">Installation <div id="installation" class="anchor"></div> <span class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100"> <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#installation" aria-label="Anchor">#</a> </span> </h2> <p>Follow the official <a href="https://immich.app/docs/overview/quick-start" target="_blank">Immich installation guide</a> for detailed instructions. Below is a quick overview of the steps to get started.</p> <pre tabindex="0"><code>cd &lt;where you like&gt; mkdir ./immich-app cd ./immich-app wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env cp example.env .env </code></pre><p>Edit the <code>.env</code> file to set your desired configuration options, such as database settings and server URLs. Make sure to set the <code>APP_URL</code> to your server&rsquo;s URL.</p> C http://localhost:1313/notes/coding/cheat_sheet/c/ Fri, 20 Sep 2024 04:17:50 +0000 http://localhost:1313/notes/coding/cheat_sheet/c/ <!-- 笔试题有的时候不给正常输入,只给plain text --> <h2 class="relative group">Format Specifier <div id="format-specifier" class="anchor"></div> <span class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100"> <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#format-specifier" aria-label="Anchor">#</a> </span> </h2> <p>Common specifiers:</p> <pre tabindex="0"><code>%d int %u unsigned int %c char %s string (char s[]) %p void* %ld long %lld long long (64bits) %f float/double %lf float/double(usually used in scanf) </code></pre><p>We can extend the format specifiers:</p> <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-C" data-lang="C"><span class="line"><span class="cl"><span class="nf">printf</span><span class="p">(</span><span class="s">&#34;%5d&#34;</span><span class="p">,</span> <span class="mi">33</span><span class="p">);</span> <span class="c1">// width &#34; 33&#34; </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="nf">printf</span><span class="p">(</span><span class="s">&#34;%.2f&#34;</span><span class="p">,</span> <span class="mf">3.14159</span><span class="p">);</span> <span class="c1">// precision &#34;3.14&#34; </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="nf">printf</span><span class="p">(</span><span class="s">&#34;%8.2f&#34;</span><span class="p">,</span> <span class="mf">3.14159</span><span class="p">);</span><span class="c1">// &#34; 3.14&#34; </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="nf">printf</span><span class="p">(</span><span class="s">&#34;%-5d&#34;</span><span class="p">,</span> <span class="mi">33</span><span class="p">);</span> <span class="c1">//Alignment &#34;33 &#34; </span></span></span></code></pre></div> <h2 class="relative group">IO <div id="io" class="anchor"></div> <span class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100"> <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style="text-decoration-line: none !important;" href="#io" aria-label="Anchor">#</a> </span> </h2> <p>Read or print via terminal:</p> C++ http://localhost:1313/notes/coding/cheat_sheet/cpp/ Fri, 20 Sep 2024 04:17:50 +0000 http://localhost:1313/notes/coding/cheat_sheet/cpp/ Python http://localhost:1313/notes/coding/cheat_sheet/python/ Fri, 20 Sep 2024 04:17:50 +0000 http://localhost:1313/notes/coding/cheat_sheet/python/