通过修改注册表修改环境变量
@echo off
set mysql_path=D:\mysql\bin
set PATH=%PATH%;%mysql_path%;
set RegV=HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
reg add "%RegV%" /v "Path" /t REG_EXPAND_SZ /d "%PATH%" /f
reg所有命令集合
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/reg-add
更新git子项目:
第一种方法:
git submodule update --init --recursive
git status
git pull
第二种方法:
git submodule init
git submodule update
git pull orgin master
删除远程分支:
git branch -a
git push origin --delete xxx
删除本地分支:
git branch -d xxx
切换分支:
git checkout xxx
QLatin1String和QStringLiteral
a. 如果操作支持对const char那么QLatin1String的使用比QString的效率高,它和const char的效率接近,仅仅时对其很浅的封装;
b. 如果操作只支持QString,那么无论时传递const char* 和QLatin1String,它都将隐士转换成QString,因此此时应使用QStringLiteral宏,它是个lambda表达式,会将只读QString字符串保存至程序的.rodata。由于QString是隐士共享的因此没有拷贝等开销。
扩展:.bss、.data 、.rodata
首先全局变量放在全局内存中、static修饰的局部变量也放在全局内存中,但是其作用域是局部的。在ELF格式的可执行文件中,全局内存有三种:.bss、.data 、.rodata
a. bss指没有初始化和初始化为0的全局变量
b. data指初始化过(非零)的非const的全局变量
c. rodata(read only data)指只读数据(const)
rodata简单说明:
常量不一定都放在rodata,有的直接编码在指令里,存在代码段(.text)中,对于字符串常量,编译器自动去掉重复字符串,保证只有一份拷贝在多进程间共享,能够提高空间利用率,有的嵌入式系统,其直接放在ROM里,运行时直接读取ROM,无需加载到RAM
为什么不能用const修饰类的静态成员函数:
const限定符作用于非静态成员函数时,会影响this指针,使得this指针为 const*,而静态成员函数没有this指针,因此没有意义
写代码时在最开始就去做的事:
- 创建命名空间,命名空间和代码添加空格
- 类的成员变量添加_
- 类成员函数返回添加const、函数形参尽可能传递const引用
- 抵制烂名字
- 抵制重复
- 范围for循环无脑使用const auto&
qbs在写依赖第三方库的用法:
cpp.includePaths: base.concat("xx/include/xx")
cpp.libraryPaths: base.concat("xx/lib/" + qbs.buildVariant)
cpp.staticLibraries: ["xxx", "xxx"]
cpp.dynamicLibraries: []
ssh连接服务器命令:
ssh root@allianceshan.top
打印端口的连接数量:
windows: netstat -ant |find /C `"192`"
linux: netstat -nat | grep -i "80" | wc -l
更改window ssh连接时默认shell
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
css样式表参考网站
jinJa拼接url
{%for pdbFile in g.vizPDBFiles %}
{%set url=url_for('package.downloader',filename=pdbFile) %}
<li><a href="{{url}}">{{pdbFile}}</a></li>
{%endfor%}
Qt密码不使用小圆点
lineedit-password-character:42;
==Qt开源项目地址:==
https://www.zhihu.com/question/25649197
https://inqlude.org/libraries/kddockwidgets.html
https://github.com/fffaraz/awesome-cpp#asynchronous-event-loop
[[Category:Windows脚本]]
screen 基本使用
screen -ls
screen -S flask
screen -r flask