From 6f358dc7883433ab14b0a69c462bfd89053db903 Mon Sep 17 00:00:00 2001 From: Awin Huang Date: Mon, 10 Feb 2025 17:42:34 +0800 Subject: [PATCH] vault backup: 2025-02-10 17:42:34 --- 20.02. CPP/{C 17.md => C++17.md} | 0 ...t Be.md => C++20, How Hard Could It Be.md} | 0 20.02. CPP/{C 20.md => C++20.md} | 0 ... parts.md => Modern CPP The good parts.md} | 0 ...omium.md => Modern CPP use in Chromium.md} | 0 20.02. CPP/Structured binding declaration.md | 11 +++ 20.02. CPP/chrono.md | 10 ++- 20.02. CPP/for_each.md | 13 ++- 20.02. CPP/lambda.md | 2 +- 20.02. CPP/move operator.md | 13 ++- 21.02. Linux/crontab-AWIN-MSIGP65.md | 79 ------------------- .../RC/Traxxas Sledge.md | 0 .../RC/好盈電變調整中立點.md | 0 .../RC/差速器調教教學.md | 0 .../模型/舊化作例.md | 0 .../軍武/虎式.md | 0 16 files changed, 44 insertions(+), 84 deletions(-) rename 20.02. CPP/{C 17.md => C++17.md} (100%) rename 20.02. CPP/{C 20, How Hard Could It Be.md => C++20, How Hard Could It Be.md} (100%) rename 20.02. CPP/{C 20.md => C++20.md} (100%) rename 20.02. CPP/{Modern C The good parts.md => Modern CPP The good parts.md} (100%) rename 20.02. CPP/{Modern C use in Chromium.md => Modern CPP use in Chromium.md} (100%) delete mode 100644 21.02. Linux/crontab-AWIN-MSIGP65.md rename {21.99 .興趣嗜好 => 21.99. 興趣嗜好}/RC/Traxxas Sledge.md (100%) rename {21.99 .興趣嗜好 => 21.99. 興趣嗜好}/RC/好盈電變調整中立點.md (100%) rename {21.99 .興趣嗜好 => 21.99. 興趣嗜好}/RC/差速器調教教學.md (100%) rename {21.99 .興趣嗜好 => 21.99. 興趣嗜好}/模型/舊化作例.md (100%) rename {21.99 .興趣嗜好 => 21.99. 興趣嗜好}/軍武/虎式.md (100%) diff --git a/20.02. CPP/C 17.md b/20.02. CPP/C++17.md similarity index 100% rename from 20.02. CPP/C 17.md rename to 20.02. CPP/C++17.md diff --git a/20.02. CPP/C 20, How Hard Could It Be.md b/20.02. CPP/C++20, How Hard Could It Be.md similarity index 100% rename from 20.02. CPP/C 20, How Hard Could It Be.md rename to 20.02. CPP/C++20, How Hard Could It Be.md diff --git a/20.02. CPP/C 20.md b/20.02. CPP/C++20.md similarity index 100% rename from 20.02. CPP/C 20.md rename to 20.02. CPP/C++20.md diff --git a/20.02. CPP/Modern C The good parts.md b/20.02. CPP/Modern CPP The good parts.md similarity index 100% rename from 20.02. CPP/Modern C The good parts.md rename to 20.02. CPP/Modern CPP The good parts.md diff --git a/20.02. CPP/Modern C use in Chromium.md b/20.02. CPP/Modern CPP use in Chromium.md similarity index 100% rename from 20.02. CPP/Modern C use in Chromium.md rename to 20.02. CPP/Modern CPP use in Chromium.md diff --git a/20.02. CPP/Structured binding declaration.md b/20.02. CPP/Structured binding declaration.md index b596e94..02f485b 100644 --- a/20.02. CPP/Structured binding declaration.md +++ b/20.02. CPP/Structured binding declaration.md @@ -1,3 +1,11 @@ +--- +tags: cpp17 +aliases: +date: 2025-02-10 +time: 17:34:18 +description: +--- + Structured binding declaration 可以把對應的 tuple、pair、vector 展開,讓 code 更好讀。 ## 展開 tuple @@ -55,3 +63,6 @@ for (const auto& [name, phone] : phoneBook) { std::cout << "Name: " << name << ", phone: " << phone << std::endl; } ``` + + +# 參考來源 \ No newline at end of file diff --git a/20.02. CPP/chrono.md b/20.02. CPP/chrono.md index 4165a14..f647e18 100644 --- a/20.02. CPP/chrono.md +++ b/20.02. CPP/chrono.md @@ -1,4 +1,10 @@ -Language: C++11 +--- +tags: cpp11 +aliases: +date: 2025-02-10 +time: 17:38:00 +description: +--- ## header ```cpp @@ -75,5 +81,5 @@ std::cout << std::ctime( &now_c ) << std::endl; 而如果是使用 Boost 的版本的話,Boost 則是另外有提供 chrono_io.hpp 這個檔案,在裡面替 duration 和 time_point 定義了輸出的格式,可以直接使用,相當地方便~有興趣的話,可以參考 [Boost 的官方說明](http://www.boost.org/doc/libs/1_55_0/doc/html/chrono/users_guide.html#chrono.users_guide.tutorial.i_o)。 -## 參考來源 +# 參考來源 - [C++11 STL 的時間函式庫:chrono – Heresy's Space](https://kheresy.wordpress.com/2013/12/27/c-stl-chrono/) \ No newline at end of file diff --git a/20.02. CPP/for_each.md b/20.02. CPP/for_each.md index 15c8564..d46dc6d 100644 --- a/20.02. CPP/for_each.md +++ b/20.02. CPP/for_each.md @@ -1,3 +1,11 @@ +--- +tags: cpp17 +aliases: +date: 2025-02-10 +time: 17:37:31 +description: +--- + for_each 是一個 function,它的原型是: ```cpp template @@ -21,4 +29,7 @@ for_each( val += 1; } ); -``` \ No newline at end of file +``` + + +# 參考來源 diff --git a/20.02. CPP/lambda.md b/20.02. CPP/lambda.md index b52afb7..461efdc 100644 --- a/20.02. CPP/lambda.md +++ b/20.02. CPP/lambda.md @@ -1,5 +1,5 @@ --- -tags: +tags: cpp11, cpp14 aliases: date: 2022-06-12 time: 18:21:42 diff --git a/20.02. CPP/move operator.md b/20.02. CPP/move operator.md index dc79c8f..f440cda 100644 --- a/20.02. CPP/move operator.md +++ b/20.02. CPP/move operator.md @@ -1,3 +1,11 @@ +--- +tags: cpp14 +aliases: +date: 2025-02-10 +time: 17:35:40 +description: +--- + move operator可以讓[[rvalue]]被參考,從而進一部的消除複製的成本。例如,以下的function會回傳一個很大的陣列: ```cpp vector generateBigArray() { @@ -56,4 +64,7 @@ Array& Array::operator=(const Array&& rhs) std::vector my_dictionary(10000000); std::vector dictionary2 = std::move(my_dictionary); ``` -在`std::move`之後,my_dictionary的size會變成0。 \ No newline at end of file +在`std::move`之後,my_dictionary的size會變成0。 + + +# 參考來源 diff --git a/21.02. Linux/crontab-AWIN-MSIGP65.md b/21.02. Linux/crontab-AWIN-MSIGP65.md deleted file mode 100644 index 2ee48db..0000000 --- a/21.02. Linux/crontab-AWIN-MSIGP65.md +++ /dev/null @@ -1,79 +0,0 @@ -### 加入 -使用`crontab -e`,然後加入這一行: -`*/1 * * * * /home/awin/script/ddns.sh` - -### 說明 -![[Pasted image 20240111231507.png]] -依序是 **分鐘,   小時,   日期,   月份,    星期,   command** -參數為 0-59,   0-23,   1-31,  1-21,   0-6,   需要執行的command -**※ 星期參數為 0 代表星期日** - -- 【*】:星號,代表任何時刻都接受的意思 -- 【,】:逗號,代表分隔時段。例如:30 9,17 * * * command,代表早上 9 點半和下午五點半都執行 command。 -- 【-】:減號,代表一段時間範圍。例如:15 9-12 * * * command,代表從 9 點到 12 點的每個 15 分都執行 command。 -- 【/n】:斜線,n 代表數字,表示每個 n 單位間隔。例如:*/5 * * * * command,代表每隔 5 分鐘執行一次 command。 - -還有一些人性化的參數,一次取代全部五個數字參數 -- 【@reboot】 :僅在開機的時候執行一次。 -- 【@yearly】 :一年執行一次,和0 0 1 1 * command效果一樣。 -- 【@annually】:(和@yearly一樣) -- 【@monthly】:一個月執行一次,和0 0 1 * * command效果一樣。 -- 【@weekly】:一個星期執行一次,和0 0 * * 0 command效果一樣。 -- 【@daily】:每天執行,和0 0 * * * command效果一樣。 -- 【@midnight】:(和@daily一樣) -- 【@hourly】 :每小時執行,和0 * * * * command效果一樣。 - -### 範例 -- 每 5 分鐘執行一次: - - `*/5 * * * *  root    /usr/libexec/atrun` -- 每 5 小時執行一次 - - `​* */5 * * * root    /usr/libexec/atrun` -- 每天 AM 5:00 執行指令(星號與星號之間要有空隔) - - `​00 05   * * *  username /bin/bash /路徑/command` -- 1 至 20 號每天執行一次 - - ​`0 1 1-20  * * root    /usr/libexec/atrun` -- 當分針移到第 5 分時,執行此 cron - - `​5 * * * * root    /usr/libexec/atrun` -- 當時針移到 1 點 1 分時,執行此 cron - - ​`1 1 * * * root    /usr/libexec/atrun` -- 每週一的 1 點 1 分,執行 - - `​1 1 * * 1 root    /usr/libexec/atrun` -- 2 月 29 日時針到 1 點 1 分,執行 - - ​`1 1 29 2 * root    /usr/libexec/atrun` -- 8 點到 16 點每 5 分鐘執行一次 cron - - `​/5 8-16 * * *   root    /usr/libexec/atrun` - -### crontab 命令 -#### 啟動 -`sudo service cron start` - -#### 重新啟動 -`/etc/init.d/cron restart` - -#### 查詢service狀態 -`sudo /etc/init.d/cron status` - -#### 編輯 crontab -`crontab -e` - -### `awin` 的 crontab -``` -# m h day mon weekday command -*/5 * * * * /home/awin/script/clean_nextcloud.sh -``` - -### `root` 的 crontab -``` -# m h day mon dow command -*/3 * * * * /home/awin/script/ddns.sh > /home/awin/log/ddns.log 2>&1 -*/5 * * * * /home/awin/script/clean_nextcloud.sh > /home/awin/log/clean_nextcloud.log 2>&1 -1 2 * * 1 /home/awin/script/backup_adguardhome.sh > /home/awin/log/backup_docker_adguardhome.log 2>&1 -2 2 * * 1 /home/awin/script/backup_filebrowser.sh > /home/awin/log/backup_docker_filebrowser.log 2>&1 -3 2 * * 1 /home/awin/script/backup_freshrss.sh > /home/awin/log/backup_docker_freshrss.log 2>&1 -4 2 * * 1 /home/awin/script/backup_gitea.sh > /home/awin/log/backup_docker_gitea.log 2>&1 -5 2 * * 1 /home/awin/script/backup_immich.sh > /home/awin/log/backup_docker_immich.log 2>&1 -1 2 * * 2 /home/awin/script/backup_nextcloud.sh > /home/awin/log/backup_docker_nextcloud.log 2>&1 -* * 1 * * /home/awin/script/backup_dotfiles_awin-pc2.sh > /home/awin/log/backup_dotfiles_awin-pc2.log 2>&1 -@reboot /home/awin/script/fan_hddtemp_exportor.py > /home/awin/log/fan_hddtemp_exportor.log 2>&1 -@reboot /home/awin/script/reboot_echo.sh > /home/awin/log/reboot.log 2>&1 -``` diff --git a/21.99 .興趣嗜好/RC/Traxxas Sledge.md b/21.99. 興趣嗜好/RC/Traxxas Sledge.md similarity index 100% rename from 21.99 .興趣嗜好/RC/Traxxas Sledge.md rename to 21.99. 興趣嗜好/RC/Traxxas Sledge.md diff --git a/21.99 .興趣嗜好/RC/好盈電變調整中立點.md b/21.99. 興趣嗜好/RC/好盈電變調整中立點.md similarity index 100% rename from 21.99 .興趣嗜好/RC/好盈電變調整中立點.md rename to 21.99. 興趣嗜好/RC/好盈電變調整中立點.md diff --git a/21.99 .興趣嗜好/RC/差速器調教教學.md b/21.99. 興趣嗜好/RC/差速器調教教學.md similarity index 100% rename from 21.99 .興趣嗜好/RC/差速器調教教學.md rename to 21.99. 興趣嗜好/RC/差速器調教教學.md diff --git a/21.99 .興趣嗜好/模型/舊化作例.md b/21.99. 興趣嗜好/模型/舊化作例.md similarity index 100% rename from 21.99 .興趣嗜好/模型/舊化作例.md rename to 21.99. 興趣嗜好/模型/舊化作例.md diff --git a/21.99 .興趣嗜好/軍武/虎式.md b/21.99. 興趣嗜好/軍武/虎式.md similarity index 100% rename from 21.99 .興趣嗜好/軍武/虎式.md rename to 21.99. 興趣嗜好/軍武/虎式.md