1.安装mingw64并将其加入path环境变量
2.解压boost.7z到Program Files
3.cd "C:\Program Files\boost_1_83_0\tools\build"
4.构建b2:bootstrap.bat gcc
5.安装Boost.Build:b2 --prefix="C:\boost-build" install
6.构建需要的library,使用–with-library_name

1
.\tools\build\b2.exe  --build-dir="C:\Program Files\boost_1_83_0\build" --with-program_options toolset=gcc install

nohup <命令> &

nohup <command> > <log> 2>&1 &
后台运行,默认将输出信息放到文件nohup.out

ctrl+z

将正在运行的命令放入后台,并暂停程序。

jobs

查看后台进程

fg %<jobsNumber>

将后台程序放到前台运行

bg

将后台暂停运行的程序在后台继续运行

Ctrl+c

结束前台运行的程序

kill

结束程序
kill %<jobsNumber>

kill pid

ps显示进程树

ps -ef --forest

ps -afx

查看端口占用程序的pid

1
netstat -aon|findstr ":<port>"

查看对应pid的程序

1
tasklist|findstr "<pid>"

结束对应pid的进程

1
taskkill /T /F /PID <pid>

申请证书

先关闭服务器,防止端口占用,再运行下面的命令

1
certbot certonly --standalone

查看证书列表

1
certbot.exe  certificates

删除不需要的证书

1
certbot delete --cert-name <domain-name>

定时更新证书

crontab -e
添加

1
0       0       10      *       *       /usr/bin/certbot renew

boost::program_options

1
2
3
4
5
po::options_description desc("Allowed options");
desc.add_options()
("help,h", "produce help message")
("compression,c", po::value<double>(), "set compression level")
;

help,h之间不能有空格,否则识别不出-h参数

g++使用include头文件目录时报错

1
2
3
$ g++.exe -I "C:\Program Files\boost\" hello.cpp  
g++.exe: fatal error: no input files
compilation terminated.

需要将\改为\\或者/

1
g++.exe -I "C:/Program Files/boost/" hello.cpp 

vscode中错误检查

Ctrl+Alt+p:选择c/c++编辑配置=>包含路径(includePath)=>换行添加,就可以运行intellisense进行语法检查了。
然后在.vscode/tasks.json中添加includePath,就能使用F5运行项目

1
2
3
4
5
6
7
8
9
10
{
"tasks": [
{
"args": [
"-I",
"<yourIncludePath>"
],
}
]
}

vscode的intellisense找不到头文件

将头文件目录放到includePath下面

1
2
3
4
5
6
7
8
9
{
"configurations": [
{
"includePath": [
"${workspaceFolder}/src"
],
}
]
}

常用命令

-j:多线程编译

1
2
3
4
5
6
7
8
9
10
11
12
cmake  -G "MinGW Makefiles" ..
mingw32-make.exe -j 12
或者
cmake --build .

cmake --install .
ctest.exe -VV
cpack -G ZIP

cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..

宏定义可以在源文件中使用

target_compile_definitions

target_include_directories(app PRIVATE src)

include查找目录不递归,在源文件中使用相对路径”/.h”。

nginx报错

1
2
3
# nginx
2023/11/13 08:36:38 [error] 1399#1399: open() "/run/nginx.pid" failed (2: No such file or directory)

解决方法:
在配置文件中配置

1
2
# nginx.conf
pid logs/nginx.pid;

并新建文件夹和文件

nginx配置ipv6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# nginx.conf
server {
listen 80;
listen [::]:80;
return 301 https://$host$request_uri;
}
server {
# 配置域名
server_name nb.waol.tk;

# https默认端口
listen [::]:443 ssl;
listen 443 ssl;
ssl_certificate fullchain.pem;
ssl_certificate_key privkey.pem;
root /blog/public;
index index.php index.html index.htm;
}

server {
if ($host = practi.tk) {
return 301 https://$host$request_uri;
}
}

电信ipv6的80端口被封

网络改桥接后80端口依然被封

windows下nginx配置

管理员权限启动powershell,运行nginx,同意通过防火墙

移除没有使用的包Removing unused packages (orphans)

1
# pacman -Qtdq | pacman -Rns -

没有找到的话错误:有参数 '-' 但标准输入流为空

管理员身份运行privoxy

添加到config.txt

1
2
3
# 监听8118端口,转发给1080端口的socks5代理
listen-address 0.0.0.0:8118
forward-socks5 / 127.0.0.1:1080 .

1
2
3
4
5
6
7
8
declare module 'use-untyped-hook' {
export interface InputProps { ... } // type declaration for prop
export interface ReturnProps { ... } // type declaration for return props
export default function useUntypedHook(
prop: InputProps
// ...
): ReturnProps;
}
0%