Python中配置国内镜像源
Python pip默认使用国外的镜像,在下载安装软件包时速度比较非常慢,要配置成国内镜像源。本文主要介绍Python pip 配置使用国内镜像源的方法。 1. 配置使用国内镜像源方法 1.1. 通过命令来临时指定 可以直接在 pip 命令中使用 -i参数来指定镜像地址,例如: [crayon-6512c564d35d01793… 阅读更多 »Python中配置国内镜像源
Python pip默认使用国外的镜像,在下载安装软件包时速度比较非常慢,要配置成国内镜像源。本文主要介绍Python pip 配置使用国内镜像源的方法。 1. 配置使用国内镜像源方法 1.1. 通过命令来临时指定 可以直接在 pip 命令中使用 -i参数来指定镜像地址,例如: [crayon-6512c564d35d01793… 阅读更多 »Python中配置国内镜像源
1. 认识Pandas Pandas 是 Python 语言的一个扩展程序库,用于数据挖掘和数据分析,同时也提供数据清洗功能。 pandas(panel data & data analysis),是基于 numpy(提供高性能的矩阵运算)专门用于数据分析的工具,是一个强大的分析结构化数据(表格数据)的工具集; Pand… 阅读更多 »Pandas库DataFrame_Series入门
1. gitlab中配置静态代码检查 在Go语言中,可以使用一些第三方工具来进行静态代码扫描,常用的工具包括: Go vet:Go语言官方提供的工具,用于检查代码中的常见错误和问题; oLint:静态分析工具,可以检查代码中的一些不规范的写法和风格; GoMetaLinter:Go语言的多工具静态代码分析器,可以集成多种静态分析… 阅读更多 »Golang静态代码扫描
这里给大家分享用于Pandas中合并数据的 5 个最常用的函数。这样大家以后就可以了解它们的差异,并正确使用它们了。 在文章开始之前,我们需要创建两个简单的 DataFrame 对象。 import pandas as pd df0 = pd.DataFrame({"a": [1, 2, 3], "… 阅读更多 »Python中Pandas用于合并数据的 5 个最常用的函数
1. 问题 go1.16之前不使用第三方包前提下实现如下功能是比较困难的 编译后的二进制文件和ini/toml/yaml格式的配置文件必须同时存在,仅移动二进制文件可能就跑不起来了 开发一个简单的http服务,引入了js、css、html文件最终需要与go源码编译后的二进制文件保证正确的文件路径结构,然后一起压缩成一个文件后才能… 阅读更多 »Golang嵌入静态文件embed(转载)
1. 第一种方法:工具调试 1.1. ps -ef 查看进程号
1 2 3 4 |
[root@local]# ps -ef |grep test root 967496 967456 99 09:57 ? 00:06:52 /usr/bin/test-controller-cn -conf /etc/tester/config.yaml root 970312 964216 0 09:59 pts/29 00:00:00 grep --color=auto test |
1.1. ps -eLF 查看进程对应线程,采用的CPU核心号 -e 或者-A,选择所有的进程 L 显示线程信息 F 显示该线程使用CPU核心序号 [crayon-6512c564daca359020… 阅读更多 »Golang程序性能排查
1. dlv的安装 delve,简称dlv是go语言的最常用的调试器,获取dlv的操作命令如下:
1 2 3 |
go get -u github.com/derekparker/delve/cmd/dlv #验证dlv安装 dlv version |
安装后直接运行dlv将会看到如下信息:
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
[root@localhost ~]# dlv Delve is a source level debugger for Go programs. Delve enables you to interact with your program by controlling the execution of the process, evaluating variables, and providing information of thread / goroutine state, CPU register state and more. The goal of this tool is to provide a simple yet powerful interface for debugging Go programs. Pass flags to the program you are debugging using `--`, for example: `dlv exec ./hello -- server --config conf/config.toml` Usage: dlv [command] Available Commands: attach Attach to running process and begin debugging. connect Connect to a headless debug server. core Examine a core dump. dap [EXPERIMENTAL] Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP). debug Compile and begin debugging main package in current directory, or the package specified. exec Execute a precompiled binary, and begin a debug session. help Help about any command run Deprecated command. Use 'debug' instead. test Compile test binary and begin debugging program. trace Compile and begin tracing program. version Prints version. Flags: --accept-multiclient Allows a headless server to accept multiple client connections. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) --disable-aslr Disables address space randomization --headless Run debug server only, in headless mode. -h, --help help for dlv --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. --log-dest string Writes logs to the specified file or file descriptor (see 'dlv help log'). --log-output string Comma separated list of components that should produce debug output (see 'dlv help log') --only-same-user Only connections from the same user that started this instance of Delve are allowed to connect. (default true) -r, --redirect stringArray Specifies redirect rules for target process (see 'dlv help redirect') --wd string Working directory for running the program. Additional help topics: dlv backend Help about the --backend flag. dlv log Help about logging flags. dlv redirect Help about file redirection. Use "dlv [command] --help" for more information about a command. |
2. 基础命令 上面列举了dlv的一些命令,其中常用的有如h… 阅读更多 »Golang的Dlv调试