导言
以现实中实际使用的应用为基础,根据其领域和应用计算特点来分类。
1 | len(day) |
strings, lists, tuples
1 | # Correct: |
1 | try: |
调参需要测试间隔值
1 | for i in range(1, 101, 3): |
enumerate
函数结合 for
循环遍历 list,以修改 list 中的元素。enumerate
函数返回一个包含元组的迭代器,其中每个元组包含当前遍历元素的索引和值。在 for 循环中,我们通过索引 i
修改了列表中的元素。1 | # 对于 二维list appDataDict |
itertools — 为高效循环而创建迭代器的函数
1 | for a,b,c in permutations((a,b,c)): |
x = round(x,3)
# 保留小数点后三位
1 | %c 格式化字符及其ASCII码 |
1 | print("My name is %s and weight is %d kg!" % ('Zara', 21)) |
' '.join(pass_list)
and pass_list.split(" ")
对齐"\n".join(["%-10s" % item for item in List_A])
1 | text = "Hello, world!" |
Python2.6 开始,通过 {}
和 :
来代替以前的 %
1 | >>>"{} {}".format("hello", "world") # 不设置指定位置,按默认顺序 |
数字处理
1 | print("{:.2f}".format(3.1415926)) # 保留小数点后两位 |
https://www.runoob.com/python/python-lists.html
1 | #创建元组 |
1 | 'a': 1, 'b': 2, 'b': '3'} tinydict = { |
empty dict
1 | a= {} |
1 | a_dict = {'color': 'blue'} |
1 | del tinydict['Name'] # 删除键是'Name'的条目 |
1 | tinydict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'} |
无序不重复序列
1 | a= set() # 空set |
1 | thisset.add("Facebook") |
1 | s.remove( x ) |
1 | setL=set(listV) |
1 | my_set = {'Geeks', 'for', 'geeks'} |
https://blog.csdn.net/weixin_63719049/article/details/125680242
Intel SDM(Software Developer's Manual)
This set consists of
volume | Descriptions | pages(size) |
---|---|---|
volume 1 | Basic Architecture | 500 pages(3MB) |
volume 2 (combined 2A, 2B, 2C, and 2D) | full instruction set reference | 2522 pages(10.8MB) |
volume 3 (combined 3A, 3B, 3C, and 3D) | system programming guide | 1534 pages(8.5MB) |
volume 4 | MODEL-SPECIFIC REGISTERS (MSRS) | 520 pages |
volume3: Memory management(paging), protection, task management, interrupt and exception handling, multi-processor support, thermal and power management features, debugging, performance monitoring, system management mode, virtual machine extensions (VMX) instructions, Intel® Virtualization Technology (Intel® VT), and Intel® Software Guard Extensions (Intel® SGX).
more graph and easier to read.
暂无
暂无
上面回答部分来自ChatGPT-3.5,没有进行正确性的交叉校验。
https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html
timedatectl
是一个管理日期和时间的工具,可以用来永久设置系统时间和时区。
1 | sudo timedatectl set-time "2024-10-26 19:12:19" |
如果发现时区也不正确,可以用下面的命令设置时区:
1 | sudo timedatectl set-timezone "Asia/Shanghai" |
例如,将时区设置为中国标准时间 (CST, UTC+8),时区名称需要使用 timedatectl list-timezones
查看可用的时区列表。
1 | df -h . |
deep为1
1 | du -h -d . |
1 | # thi |
ps aux linux command whill show no zero cpu usage when the process is sleeping beacuse of its snapshots mechanism
1 | dpkg: 处理归档 /var/cache/apt/archives/bat_0.12.1-1build1_arm64.deb (--unpack)时出错: |
1 | sudo apt-get purge -h |
tree -L DepthSIze Folder_Path
1 | #分析symbols |
综合来看,使用 nm -gDC <filename>
命令可以查看一个二进制可执行文件或者共享库中的全局符号表和动态符号表,并将包含其中的 C++ 符号名还原成源代码中的名称。
1 | shaojiemike@snode6 ~/github/gem5 [10:49:56] |
It is all started with two confusing situation.
ps aux | grep -v process_name
, the process is in Sl+
state. But the cpu usage is not zero.watch "ps aux |grep 3496617"
always show the same cpu usage percentage, which is very confusing beacause htop
always show up-down value. and pidstat -p 3516617
show cpu% less than 100%.隐藏文件夹 .github , 里面放两个文件:
ISSUE_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
仓库有两个基础分支:
dev(默认分支)
master(用于发布)
通过pull request来合并新的代码:
协作者的代码通过pr合并到dev
dev通过pr合并到master
注意点:
merge 到 dev,使用squash merge
merge 到 master,使用普通的merge
永远不向master直接commit代码
只有一个长期分支 master ,而且 master 分支上的代码,永远是可发布状态,
to do
github自带的,貌似比Travis CI好用
ctest 怎么写
Travis CI 提供的是持续集成服务(Continuous Integration,简称 CI)。它绑定 Github 上面的项目,只要有新的代码,就会自动抓取。然后,提供一个运行环境,执行测试,完成构建,还能部署到服务器。
持续集成的好处在于,每次代码的小幅变更,就能看到运行结果,从而不断累积小的变更,而不是在开发周期结束时,一下子合并一大块代码。
使用准备
.travis.yml
运行流程
可选部分
1 | before_install:install 阶段之前执行 |
运行状态
1 | passed:运行成功,所有步骤的退出码都是0 |
可选加密环境变量
Angular规范
1 | <type>(<scope>): <subject> |
name | description | 实例 |
---|---|---|
feat: | 新功能(feature)。 | 打印函数 feat: Add print function for enhanced runtime information |
fix/to: | 修复bug,可以是QA发现的BUG,也可以是研发自己发现的BUG。 | |
fix: | 产生diff并自动修复此问题。适合于一次提交直接修复问题 | |
to: | 只产生diff不自动修复此问题。适合于多次提交。最终修复问题提交时使用fix | |
docs: | 文档(documentation)。 | |
style: | 格式(不影响代码运行的变动)。 | |
refactor: | 重构(即不是新增功能,也不是修改bug的代码变动)。 | |
perf: | 优化相关,比如提升性能、体验。 | |
test: | 增加测试。 | |
chore: | 构建过程或辅助工具的变动。 | |
revert: | 回滚到上一个版本。 | |
merge: | 代码合并。 | |
sync: | 同步主线或分支的Bug。 |
格式为:
1 | <type>(<scope>): <subject> |
revert:
, followed by the header of the reverted commit. In the body it should say: This reverts commit <hash>.
, where the hash is the SHA of the commit being reverted.*
.
结尾BREAKING CHANGE:
with a space or two newlines. The rest of the commit message is then used for this.插件 vscode插件git-commit-plugin
命令行 husky + commitlint
Standard Version
1 | npm cache clean --force #npm指令清除npm缓存 |
1 | "scripts": { |
CHANGELOG.md 记录内容的配置
1 | { |
使用Standard Version
1 | // 初次发布版本 |
Commitizen for contributors
Visual Studio Code Commitizen Support
vscode的插件
conventional-changelog/commitlint
阻止不规范的提交
github-release-notes,以下简称 gren ,是用来一键向 github 发布 release notes 的工具。
https://zhuanlan.zhihu.com/p/99499246
https://blog.csdn.net/weixin_39586683/article/details/110643111
版本格式:主版本号.次版本号.修订号,版本号递增规则如下:
主版本号:当你做了不兼容的 API 修改,
次版本号:当你做了向下兼容的功能性新增,
修订号:当你做了向下兼容的问题修正。
先行版本号及版本编译信息可以加到“主版本号.次版本号.修订号”的后面,作为延伸。
写个github模板
set(Boost_USE_STATIC_LIBS ON)
set(Boost_DEBUG ON)
Boost_INCLUDE_DIR: 含有boost头文件的目录
Boost_LIBRARYDIR: 偏好的含有boost库的库目录
https://stackoverflow.com/questions/3897839/how-to-link-c-program-with-boost-using-cmake
http://c.biancheng.net/view/7772.html cache?
cmake boost install path
https://cloud.tencent.com/developer/ask/107360
设置boost-root 查看安装位置
Travis-CI 依赖软件包每次都要重新安装吗
https://stackoverflow.com/questions/57982945/how-to-apt-get-install-in-a-github-actions-workflow
Actions may have no Boost, where
Ctest add build/bin to test
Ctest https://www.cnblogs.com/hustcpp/p/12922998.html
暂无
还是ipcc的github组织的太烂了,需要学习一下
https://zhuanlan.zhihu.com/p/67620599
http://www.ruanyifeng.com/blog/2017/12/travis_ci_tutorial.html