2024-07-25
pyhton
00

问题背景

python项目debug起不来

解决方案: 1.设置launch.json

python
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "load_app", "type": "debugpy", "request": "launch", "program": "项目路径/server/server.py", "console": "integratedTerminal" } ] }
  1. 需要下载python Debugger插件

ae8e1008ff19b912b9cc1c7afe3c836e.png

2024-07-23
其他
00

git commit –amend 的用法

相关信息

有时我们可能会在提交后,意识到有些修改需要进行调整或者添加,这时候就可以使用git commit –amend命令来完成

首先我们第一次提交

js
git init git add test.txt git commit -m "Initial commit" git push

现在,我们意识到我们在提交前漏掉了一个感叹号。我们可以通过以下命令来修改最新的一次提交:

js
echo "Hello, Git!" > test.txt git add test.txt git commit --amend -m "Initial commit!"
2024-07-16
linux相关
00

背景:想要后台运行程序,并且不会因为终端的关闭而影响

linux
nohup ./demo > /dev/null 2>&1 &
2024-06-21
golang
00

golang上下文context的使用

作用

通过使用Context,可以做到统一的、全链路的流程控制和数据传递。

常用的方法

golang
ctx=context.WithValue(ctx,"my_key","my_value") // 设置一个值 ctx,cancel:=context.WithCancel(context.Background()) //设置一个取消信号 ctx,cancel:=context.WithTimeout(context.Background(),1*time.Second) // 设置一个超时取消信号 cancel()
2024-06-18
linux相关
00

日常中可能存在文件中包含空行的问题,针对该类问题,可以通过grep或者sed等命令进行整理

  • 通过grep进行处理
grep -v '^$' 原始文件 > 结果文件