Saki's 研究记录

Saki's 研究记录

MckeeのClub & SAKI’sブログ

Parsing a Redis connection string
背景最近在工作中需要访问redis,为了方便使用,将redis的地址、端口、密码等写到配置中读取。例如: 12345# redis configurationredis: db: 0 addr: 'redis-ip:10086' password: '******' 这样配置是没问题的,但计划赶不上变化,当需求改成写个命令行工具来读访问 redis时,就用不上配置文件了。redis的配置需要从命令行的参数传入,例如: 1cmd subcmd --redis_addr 'redis-ip:10086' --redis_pw...
Docker Error standard_init_linux.go exec user process caused exec formaterror
背景最近写了些python脚本打算把它们都扔到Docker里面去跑。写完Dockerfile测试好,push上服务器运行时报错了。 12WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requestedstandard_init_linux.go:228: exec user process caused: exec format error ...
实时性能分析工具Pyroscope
背景当服务上线后,流量增加或短暂功能故障,都会造成用户体验变差,而这时怎样才能快速找到性能瓶颈呢?这次将会介绍一套实时性能分析工具——pyroscope,让开发者可以快速定位到造成性能瓶颈的代码,而且目前还支持在 Python、Rust 或 Go 的环境。下面将主要针对 Go 环境做介绍。 什么是 Pyroscope ?Pyroscope 是一套开源的实时性能监控平台,简单的 Agent-Server 框架,让开发者可以轻松监控服务的性能,不管是要找10秒还或是多年的性能数据,都可以快速的实时呈现。由于采样分析技术,CPU 开销较低,开发者用不用在意安装此监控会不会造成任何性能上的负担...
Golang 1.18 工作区模式(workspace mode)
环境 OS: Darwin Kernel Version 21.4.0GO: go version go1.18 darwin/arm64 背景Go1.18 最 “实用“ 的功能,应该是 Go 工作区模式,它使得开发者在多个模块中的开发工作变得更加简单。 使用在同一个目录下创建两个空的 go 包 demo 和 util。 1mkdir -p workspace_mode_example/{demo,util} 然后分别使用 go mod init 来初始化。 1234cd workspace_mode_example/demogo mod init workspa...
Golang 1.18 报错:linkname must refer to declared function or variable
问题最近在mac上升级golang到1.18版本,新建gin服务执行go run时报错: 123456789101112# golang.org/x/sys/unix../../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20200116001909-b77594299b42/unix/syscall_darwin.1_13.go:25:3: //go:linkname must refer to declared function or variable../../../../go/pkg/mod/golang.org/x/sys@v0.0.0-2...
Node Sass does not yet support apple m1, Big Sur and arm64
问题换了M1芯片的MBP, 最近在原有Vue项目中执行命令编译打包: 1npm run build:prod 遇到了以下报错: 12345error in ./src/styles/index.scssError: Node Sass does not yet support your current environment: OS X Unsupported architecture (arm64) with Unsupported runtime (93)For more information on which environments are supported please ...
Including .well-known directory
背景最近尝试在Brave Rewards注册,并把自己的网站添加到频道上。其中有个步骤是要求将一个txt校验文件添加到网站,并能通过https://myblog.com/.well-known/brave-rewards-verification.txt访问。 问题创建目录在hexo/source目录下建立.well-known目录并把下载好的brave-rewards-verification.txt文件拷贝进去。 1234567.├── 404├── about├── ads.txt├── _posts├── robots.txt└── .well-known 配置修改_confi...
(MAC Big Sur 12.1) ImportError: dlopen libpq
问题在python脚本中连接postgres时遇到以下问题: 12345678Traceback (most recent call last): File "/Users/shenshijie/Documents/app/postgres/connect.py", line 2, in <module> import psycopg2 File "/opt/homebrew/lib/python3.9/site-packages/psycopg2/__init__.py", line 51, in <module>...
docker-compose部署postgres并解决connection refused错误
One of the biggest benefits of using docker for me has been the fact that it makes developing code with databases much simpler. 每当我想构建一个项目的时,倾向于使用postgres作为数据库。在Docker还没出现前,需要手动安装postgres到我本地机器,拉起服务,创建数据库表,创建指定的用户和对应的权限,最后在本地拉起项目来测试和开发。整个流程下来几个小时就过去了。 Docker出现后,事情变得异常简单。特别是在配合docker-compose使用后,...