First commit on Mac Mini server

This commit is contained in:
2025-07-25 02:15:37 +08:00
parent 6f09b5f46f
commit 64eed4e7ce
358 changed files with 67829 additions and 14729 deletions

View File

@@ -3,4 +3,10 @@ title = 'Home Page'
draft = false
+++
{{< typeit
tag=h3
lifeLike=true
>}}
Welcome to my website! I'm really happy you stopped by.
{{< /typeit >}}
# This is My Page

View File

@@ -0,0 +1,6 @@
+++
title = 'Notes'
date = 2024-09-20T04:17:50Z
draft = false
+++
Personal notes, may not be readable.

View File

@@ -0,0 +1,7 @@
+++
title = 'Coding'
date = 2024-09-20T04:17:50Z
draft = false
+++

View File

@@ -0,0 +1,7 @@
+++
title = 'Cheat Sheets'
date = 2024-09-20T04:17:50Z
draft = false
+++
Heres a cheat sheet of some programming languages, tools, and libraries that I use often—but somehow always forget.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -0,0 +1,5 @@
+++
title = 'C'
date = 2024-09-20T04:17:50Z
draft = false
+++

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

View File

@@ -0,0 +1,5 @@
+++
title = 'C++'
date = 2024-09-20T04:17:50Z
draft = false
+++

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

View File

@@ -0,0 +1,14 @@
+++
title = 'Git'
date = 2024-09-20T04:17:50Z
draft = false
+++
## submodule
## Commit
1. Add date and time in commit messages:
``` bash
git commit -m "$(date '+%Y-%m-%d %H:%M:%S')"
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 KiB

View File

@@ -0,0 +1,5 @@
+++
title = 'Python'
date = 2024-09-20T04:17:50Z
draft = false
+++

Binary file not shown.

After

Width:  |  Height:  |  Size: 925 KiB

View File

@@ -0,0 +1,19 @@
+++
title = 'Projects'
date = 2024-09-20T04:17:50Z
draft = false
+++
This is the Projects page, where I keep track of all my personal and collaborative work.
I use several tags to describe the status and nature of each project:
- `Private`/ `Public`: Private projects wont reveal too many details, but Ill still document the process, to-do lists, and partial results. For Public projects, I aim to share as much as possible — from design to implementation.
- `Idea`, `Ongoing`, `Improving`, `Archived`: These tags indicate the current state of a project — whether its just a thought, actively being developed, being refined, or no longer maintained.
- `Original`, `Reproduce`: Original means the project was initiated and designed by me. Reproduce refers to work based on existing ideas, papers, or open-source projects — typically with modifications or improvements.
- `<Tags with other topic>`: Some projects are interdisciplinary. Additional tags will be added to reflect relevant topics, but each project will be placed under the one category its most closely related to.

View File

@@ -0,0 +1,6 @@
+++
title = 'Fancy Things on Boards'
date = 2024-09-20T04:17:50Z
draft = false
weight = 90
+++

Binary file not shown.

After

Width:  |  Height:  |  Size: 950 KiB

View File

@@ -0,0 +1,31 @@
+++
title = 'Self-host Projects'
date = 2024-09-20T04:17:50Z
draft = false
weight = 90
+++
Ive recently been exploring the world of self-hosted solutions, and its nothing short of amazing. There are some great collections out there that showcase powerful, privacy-respecting tools you can run on your own hardware:
- [A collection on GitHub](https://github.com/awesome-selfhosted/awesome-selfhosted)
- [selfh.st](https://selfh.st/)
## ❓ Why Self-Host?
I enjoy automating tasks and making my life smarter with scripts and small tools. Having control over the services I use, running them on my own hardware, and customizing everything to suit my needs—its both empowering and educational.
<!-- ## 🧠 My Home Lab Vision
Im currently running some of my own projects on lightweight setups, but I have a bigger plan in mind: a dedicated, used physical server. That will take more time and energy to set up properly, so Ive decided to gamify the process. -->
<!-- 🎯 Goal: Once Ive built 10 great and interesting projects, with at least 3 generating income, Ill reward myself by setting up a real home lab server.
Projects:
🟩⬜⬜⬜⬜⬜⬜⬜⬜⬜ (1/10)
Income Goals:
⬜⬜⬜ (0/3) -->
Ill use this space to document the projects I build and share what I learn along the way.
## List

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 KiB

View File

@@ -0,0 +1,81 @@
+++
title = 'Website Setup'
date = 2024-09-20T04:17:50Z
draft = false
series = ["My First Server in Room"]
series_order = 1
weight = 10
+++
I don't have a public IP, so my solution is SSH tunnel + reverse Proxy on cloud server.
## 🍎Mac Mini Side
As a server, my Mac won't sleep, so change the setting firstly.
```
sudo systemsetup -setcomputersleep Never # never sleep
sudo systemsetup -setdisplaysleep 10 # display will sleep in 10 min
```
Use autossh to avoid timeout:
```
brew install autossh
```
Add the configuration below in `~/.ssh/config` Mac Mini will send package per 30 seconds to keep the connection alive.
```
Host <ip address>
ServerAliveInterval 30
ServerAliveCountMax 5
TCPKeepAlive yes
```
Build the connection:
```
autossh -M 0 -f -N \
-i ~/.ssh/id_ed25519 \
-o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" \
-R 0.0.0.0:9000:localhost:1313 \
root@<ip address>
```
```
autossh -M 0 -f -N -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -R 0.0.0.0:9000:localhost:1313 user@<your.server.com>
```
A watchdog script to try reconnection when the network lost(add to LaunchAgent):
```
#!/bin/bash
while true; do
ping -c 1 <ip address> > /dev/null 2>&1
if [ $? -ne 0 ]; then
pkill -f autossh
autossh -M 0 -f -N -R 0.0.0.0:9000:localhost:1313 <ip address>
fi
sleep 60
done
```
## 💻Server Side
Install and config the Nginx, for me the config file in `/etc/nginx/sites-available`:
```
server {
listen 80;
server_name www.<your domain> <your domain>;
location / {
proxy_pass http://localhost:9000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
To obtain a security certificate, use the certbot:
```
sudo apt update
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d swangnice.cn
```

View File

@@ -0,0 +1,33 @@
+++
title = 'NAS: Network Attachment Storage'
date = 2024-09-20T04:17:50Z
draft = false
series = ["My First Server in Room"]
series_order = 2
weight = 20
+++
## Hardware
I went with the UNITEK 3373BBK for one of my drive enclosures—and honestly, it wasnt the best decision.
The first big letdown? The bandwidth tops out at just 5Gbps. Thats fine for basic tasks, but definitely underwhelming if youre dealing with high-speed storage or large file transfers.
Even worse, it doesnt support S.M.A.R.T passthrough, which makes monitoring drive health a hassle. That was a big deal-breaker for me.
Still, none of the other options really fit my expectations either. One day, I might just go all-in and make my own enclosure—design the PCB, write the firmware, the whole deal. Maybe not today… but someday.
```
diskutil list
```
Solution: HFS+ + SMB3.0 客户端设置“延迟加载目录”或“按需索引”
```diskutil list```
```
sudo smartctl -a /dev/disk2
```
```brew install smartmontools```

View File

@@ -0,0 +1,43 @@
+++
title = 'My Own Code Vault: Gitea on Mac Mini'
date = 2024-09-20T04:17:50Z
draft = false
series = ["My First Server in Room"]
series_order = 3
weight = 30
+++
Install dependence of gitea:
```
brew install git
brew install gitea
```
Start the configuration page of Gitea:
```
gitea web
```
Install MySQL:
```
brew install mysql
brew services start mysql
```
Login MySQL and create the database and user:
```
mysql -u root
```
Then, execute:
```
CREATE DATABASE gitea CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'gitea'@'localhost' IDENTIFIED BY '<yourpassword>';
GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost';
FLUSH PRIVILEGES;
```
CREATE DATABASE gitea CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'gitea';
GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost';
FLUSH PRIVILEGES;

View File

@@ -0,0 +1,13 @@
+++
title = 'My First Server in Room: Mac Mini + SSD Enclosure'
date = 2024-09-20T04:17:50Z
draft = false
tags = ["Public", "Ongoing", "Original", "AI"]
weight = 10
+++
For my first physical server in my life, I got an Mac Mini with M4 and an HDD enclosure.

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View File

@@ -0,0 +1,15 @@
+++
title = 'TODO List'
date = 2024-09-20T04:17:50Z
draft = false
series = ["StockBot"]
series_order = 1
weight = 10
+++
## Short-term TODO
- 🚧 The Initial Policy implement (Parameterizing transaction variables)
- ⬜️ The evaluate & logger script
- ⬜ The automatic scripts with Email Sender deployed on the Server
- ⬜ Web UI, will not be too complex just a simple one to synchronous my account for customized policy
- ⬜️ Implement RL algorithms

View File

@@ -0,0 +1,10 @@
+++
title = 'Showcases'
date = 2024-09-20T04:17:50Z
draft = false
series = ["StockBot"]
series_order = 2
weight = 20
+++
This section will feature occasional showcases of my technical achievements—focused purely on the engineering side, not the income.

View File

@@ -0,0 +1,20 @@
+++
title = 'StockBot'
date = 2024-09-20T04:17:50Z
draft = false
tags = ["Private", "Ongoing", "Original", "AI"]
weight = 10
+++
This is a bot that assists in making daily index fund trading decisions.
## Introduction
This project was inspired by my mother. Over the course of ten years, she watched my father struggle in the stock market. From those hard lessons, she developed her own strategy—one that focuses on the predictable fluctuations in index fund values. Armed with nothing more than paper, a pen, and a calculator, shes been able to achieve steady profits.
I believe theres even more potential here.
By digitizing her process and gradually introducing quantifiable algorithms, I hope to both increase efficiency and explore new edges for profitability. My strategy might cause others' losses, so this project is private permanently.
## List
Here, Ill keep track of the to-do list and showcase the results as the project evolves. Ill also highlight some interesting technical insights along the way.

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

View File

@@ -3,4 +3,17 @@ title = '主页'
draft = false
+++
# 这是我的主页
{{< typeit
tag=h3
lifeLike=true
>}}
欢迎来到我的网页!希望可以在这里找到您需要的!
{{< /typeit >}}
我是一名刚毕业的大学生。
我的兴趣涵盖机器人 🤖、嵌入式系统 📟 以及摄影 📸。
在这里,我将分享我的想法、笔记、项目,还有一些有趣的内容。敬请关注!
## 目录

View File

@@ -0,0 +1,7 @@
+++
title = 'Notes'
date = 2024-09-20T04:17:50Z
draft = false
+++
Personal notes, may not be readable.
个人笔记, 不保证可读性

View File

@@ -0,0 +1,5 @@
+++
title = 'Coding'
date = 2024-09-20T04:17:50Z
draft = false
+++

View File

@@ -0,0 +1,8 @@
+++
title = 'Cheat Sheets'
date = 2024-09-20T04:17:50Z
draft = false
+++
记录一些我的常用指令

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -0,0 +1,5 @@
+++
title = 'C'
date = 2024-09-20T04:17:50Z
draft = false
+++

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

View File

@@ -0,0 +1,5 @@
+++
title = 'C++'
date = 2024-09-20T04:17:50Z
draft = false
+++

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

View File

@@ -0,0 +1,11 @@
+++
title = 'Git'
date = 2024-09-20T04:17:50Z
draft = false
+++
## Commit
1. Add date and time in commit messages:
``` bash
git commit -m "$(date '+%Y-%m-%d %H:%M:%S')"
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 KiB

View File

@@ -0,0 +1,5 @@
+++
title = 'Python'
date = 2024-09-20T04:17:50Z
draft = false
+++

Binary file not shown.

After

Width:  |  Height:  |  Size: 925 KiB

View File

@@ -0,0 +1,9 @@
+++
title = 'Projects'
date = 2024-09-20T04:17:50Z
draft = false
+++
This is projects page. I will list my projects here. Here are several tags here to describe the status of my projects:
- `private`/ `public`: I won't show too many details of my private, but I will record the process, to-do list and part of results on this site.

View File

@@ -0,0 +1,5 @@
+++
title = 'Self-host Projects'
date = 2024-09-20T04:17:50Z
draft = false
+++

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 KiB

View File

@@ -0,0 +1,14 @@
+++
title = 'TODO List'
date = 2024-09-20T04:17:50Z
draft = false
series = ["StockBot"]
series_order = 1
weight = 10
+++
## Short-term TODO
- 🚧 The Initial Policy implement
- ⬜️ The evaluate & logger script
- ⬜️ The automatic scripts with Email Sender deployed on the Server
- ⬜️ Implement RL

View File

@@ -0,0 +1,10 @@
+++
title = 'Showcases'
date = 2024-09-20T04:17:50Z
draft = false
series = ["StockBot"]
series_order = 2
weight = 20
+++
This section will feature occasional showcases of my technical achievements—focused purely on the engineering side, not the income.

View File

@@ -0,0 +1,20 @@
+++
title = 'StockBot'
date = 2024-09-20T04:17:50Z
draft = false
tags = ["Private", "Ongoing", "Original", "AI"]
weight = 10
+++
This is a bot that assists in making daily index fund trading decisions.
## Introduction
This project was inspired by my mother. Over the course of ten years, she watched my father struggle in the stock market. From those hard lessons, she developed her own strategy—one that focuses on the predictable fluctuations in index fund values. Armed with nothing more than paper, a pen, and a calculator, shes been able to achieve steady profits.
I believe theres even more potential here.
By digitizing her process and gradually introducing quantifiable algorithms, I hope to both increase efficiency and explore new edges for profitability. My strategy might cause others' losses, so this project is private permanently.
## List
Here, Ill keep track of the to-do list and showcase the results as the project evolves. Ill also highlight some interesting technical insights along the way.

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB