try: # sth except Exception as e: # 可以使用rich包 pprint.pprint(list) raise e finally: un_set()
for
间隔值
调参需要测试间隔值
1 2
for i inrange(1, 101, 3): print(i)
遍历修改值
使用 enumerate 函数结合 for 循环遍历 list,以修改 list 中的元素。
enumerate 函数返回一个包含元组的迭代器,其中每个元组包含当前遍历元素的索引和值。在 for 循环中,我们通过索引 i 修改了列表中的元素。
1 2 3 4 5
# 对于 二维list appDataDict baseline = appDataDict[0][0] # CPU Total for i, line inenumerate(appDataDict): for j, entry inenumerate(line): appDataDict[i][j] = round(entry/baseline, 7)
rows = max(len(list1), len(list2)) cols = max(len(row) for row in list1 + list2)
result = [[0] * cols for _ inrange(rows)]
for i inrange(rows): for j inrange(cols): if i < len(list1) and j < len(list1[i]): result[i][j] += list1[i][j] if i < len(list2) and j < len(list2[i]): result[i][j] += list2[i][j]
print(result)
# 将一个二维列表的所有元素除以一个数A result = [[element / A for element in row] for row in list1]
a_dict = {'color': 'blue'} for key in a_dict: print(key) # color for key in a_dict: print(key, '->', a_dict[key]) # color -> blue for item in a_dict.items(): print(item) # ('color', 'blue') for key, value in a_dict.items(): print(key, '->', value) # color -> blue
# 判断是否存在指定的键 if my_dict.get("key2") isnotNone: print("Key 'key2' exists in the dictionary.") else: print("Key 'key2' does not exist in the dictionary.")
I found out using 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%.
对于Revert: If the commit reverts a previous commit, it should begin with 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.
type的类型有:
feat: A new feature
fix: A bug fix
docs: Documentation only changes
style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)空白、格式、缺少分号等
refactor:(重构) A code change that neither fixes a bug nor adds a feature
perf: A code change that improves performance
test: Adding missing or correcting existing tests
chore: (琐事)Changes to the build process or auxiliary tools(辅助工具) and libraries such as documentation generation
scope: commit 改变的位置,如果是多处写*
subject: 简明的描述:
使用祈使句,现在时态
不要.结尾
第一个字母不要大写
body: 包括改变的动机,并将其与以前的行为进行对比。
footer: Breaking Changes或者reference GitHub issues that this commit closes. Breaking Changes should start with the wordBREAKING CHANGE: with a space or two newlines. The rest of the commit message is then used for this.
自动生成Release Notes
规范化commit
插件 vscode插件git-commit-plugin
命令行 husky + commitlint
工具
Standard Version
实现自动化版本控制,自动创建changelog, 创建 git tags
安装
1 2 3 4 5 6 7 8 9 10 11
npm cache clean --force #npm指令清除npm缓存 # 删除node_module包 npm install -g npm # npm 更新到最新 npm install -g n n latest # node 更新 Note: the node command changed location and the old location may be remembered in your current shell. old : /usr/bin/node new : /usr/local/bin/node To reset the command location hash either start a new shell, or execute PATH=$PATH" PATH=/usr/local/bin/:$PATH npm install -D standard-version
接下来,加载器跳转到程序的入口点,也就是 _start函数的地址。这个函数是在系统目标文件 ctrl.o 中定义的,对所有的 C 程序都是一样的。_start 函数调用系统启动函数 __libc_start_main,该函数定义在 libc.so 中。它初始化执行环境,调用用户层的 main 函数,处理 main 函数的返回值,并且在需要的时候把控制返回给内核。
# shaojiemike @ snode6 in ~/github/sniper_PIMProf/PIMProf/gapbs on git:dev o [15:15:29] $ size /usr/lib/llvm-10/bin/llvm-mca text data bss dec hex filename 144530 6056 8089 158675 26bd3 /usr/lib/llvm-10/bin/llvm-mca
# shaojiemike @ snode6 in ~/github/sniper_PIMProf/PIMProf/gapbs on git:dev o [15:18:14] $ l /usr/lib/llvm-10/bin/llvm-mca -rwxr-xr-x 1 root root 153K Apr 20 2020 /usr/lib/llvm-10/bin/llvm-mca