https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
Tuesday, October 26, 2021
[C] continue
#include <stdio.h>
Monday, October 25, 2021
[Linux] PS
[root@study ~]# ps aux <==觀察系統所有的程序資料
[root@study ~]# ps -lA <==也是能夠觀察所有系統的資料
[root@study ~]# ps axjf <==連同部分程序樹狀態
while true; do
ps -eo pid,ppid,cmd,%mem,%cpu --sort -pcpu,+pmem
ps -eo pid,ppid,%mem,%cpu --sort -pcpu,+pmem | awk '{if ($3!=0){total1 += $3;print "MEM:"$3"%";}} END { print "MEM:"total1"%" }'
ps -eo pid,ppid,%mem,%cpu --sort -pcpu,+pmem | awk '{if ($4!=0){total2 += $4;print "CPU:"$4"%";}} END { print "CPU:"total2"%" }'
sleep 3;
done&
當要刪除 while....
先查詢 pid
PID TTY TIME CMD
15312 pts/84 00:00:00 ps
18095 pts/84 00:00:00 bash
kill -9 pid
Reference:
https://linux.cn/article-4743-1.html
https://blog.longwin.com.tw/2017/04/linux-ps-process-show-cpu-memory-2017/
Wednesday, October 20, 2021
[C++程式設計] 字串分割與連線
1. 字串分割
#include<string>
#include<iostream>
using namespace std;
vector<string> split(const string& str, const string& delim)
{
vector<string> res;
if ("" == str) return res;
// 先將要切割的字串從string型別轉換為char*型別
char * strs = new char[str.length() + 1]; //不要忘了
strcpy(strs, str.c_str());
char * d = new char[delim.length() + 1];
strcpy(d, delim.c_str());
char *p = strtok(strs, d);
while (p) {
string s = p; //分割得到的字串轉換為string型別
res.push_back(s); //存入結果陣列
p = strtok(NULL, d);
}
return res;
}
int main()
{
cout << "=====================================================================" << endl;
cout << "待分割的字串: " << PATH << endl;
std::vector<string> res = split(PATH, "/"); // 分割符為“/”
cout << "字串分割結果:";
for (int i = 0; i < res.size(); ++i)
{
cout << res[i] << " ";
}
cout << endl;
string root = "D:/ClothProject/DataHead/down/down_image/";
string name_image;
if (res.size() == 7)
name_image = res[4] + res[5];
else
name_image = res[4];
cout << "字串連線:" << name_image << endl;
gl.depthImagePath = root;
for (int i = 1; i < 8; i++)
{
if (i == 4)
continue;
// 數字與字串連線,需要使用to_string(i)
imwrite(gl.depthImagePath + name_image + "_" + to_string(i) + ".png", gl.images[i]);
}
cout << "=====================================================================" << endl;
return 0;
}
Reference:https://www.796t.com/article.php?id=184411https://blog.csdn.net/Mary19920410/article/details/77372828?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.control
Monday, October 11, 2021
[JavaScript] 分開兩個屬性選擇器
input[class^='some_starting_constant_string'][class$='some_ending_constant_string']
console.log( document.querySelectorAll("[class*='start'][class$='end']") )
<div class="start__end"></div> <div class="start_heretoo_end"></div> <div class="sta__end"></div> <div class="rt__end"></div> <div class="start__d"></div>
Friday, October 8, 2021
Sunday, October 3, 2021
[docker] How to setup personal build environment?
Check images
docker image list
check your uid/gid
CMD: id johnny
uid=1099(johnny) gid=1099(johnny) groups=1099(johnny),133(docker)
start docker
CMD: docker run -it --name acesetup ace_env:v3 /bin/bash
root@2dac23d862a3:/#
add user
CMD: adduser johnny
finish password setting.
check your uid/gid in docker
CMD: id johnny
uid=1000(johnny) gid=1000(johnny) groups=1000(johnny)
uid/gid is differnet system & docker site. modify in docker container
CMD: usermod -u 1099 johnny
CMD: groupmod -g 1099 johnny
CMD: usermod -aG sudo johnny
exit docker container, and save the modify. (TAG)
CMD: exit
CMD: docker commit -m "add user johnny" abcsetup ace_env:johnny
check image again
CMD: docker image list
update and commit docker
docker start abcenv_ace
docker attach abcenv_ace
mkdir -p /opt/compiler_tool/selinux-3.1/sbin
ln -s /usr/sbin/setfiles /opt/compiler_tool/selinux-3.1/sbin/setfiles
exit
docker commit -m "ln -s /usr/sbin/setfiles /opt/compiler_tool/selinux-3.1/sbin/setfiles" abcenv_ace_env:ace
docker rm abcenv_ace
docker run --name abcenv_ace--privileged -v /extspace:/extspace -it abc_env:ace /bin/bash
docker start abcenv_ace
docker attach abcenv_ace
remove setup container
docker rm abcsetup
update and commit docker
docker start abcenv_ace
docker attach abcenv_ace
apt install python2
ln -s /usr/bin/python2.7 /usr/bin/python
exit
docker commit -m "ln -s /usr/bin/python2.7 /usr/bin/python" abc_env:johnny
docker rm abcenv_ace
docker run --name abcenv_ace--privileged -v /extspace:/extspace -it abc_env:ace /bin/bash
n8n index
【n8n免費本地端部署】Windows版|程式安裝x指令大補帖 【一鍵安裝 n8n】圖文教學,獲得無限額度自動化工具&限時免費升級企業版功能
-
Linux kernel模組的開發 Communcation with kernel space and user space Uevent發送(熱插拔)事件到用戶空間 Linux內核設備驅動程序從設備DMA到用戶空間內存 user space/kernel ...
-
模板直到实例化时才生成代码,所以获得模板代码编译错误的时机较晚。编译器在3个阶段报告错误: 1. 第一阶段是编译模板本身时,此时一般错误很少,只是 检查语法错误 ,不检查依赖于类型的代码 第二个阶段是遇到使用模板时,对函数模板调用编译器会 检查实参数目是否正确 。还要检查 参数类...
-
Sinking 和 Sourcing 是定義負載中直流電流控制的術語 Sinking Digital I / O為負載提供接地連接 (NPN電晶體) 低電位輸出 Sourcing Digital I / O為負載提供電壓源 (PNP電晶體) 高 電位輸出 考慮一個簡單的電路,包含...