Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

240 total results found

omitempty

Golang Protobuf

默认行为 在使用 protoc 3 时,默认会为所有标量字段(包括字符串)添加 omitempty 标签。这是 protobuf 3 的一个默认行为。要解决这个问题,有几种方式: gogoproto 例子1 Inputmessage Config { int64 id = 1; string name = 2 [(gogoproto.jsontag) = "name"]; string desc = 3 [(gogoproto.jsontag) = "desc"]; Role role = 5 ...

golang
protobuf
omitempty
programming-language

Batch Send With Timeout

Golang Snippets

idleDuration := 10 * time.Second idleDelay := time.NewTimer(idleDuration) for { idleDelay.Reset(idleDuration) msgQueue := make([]model.MinIOEvent, 0, BatchSize) var needToSend bool for !needToSend { select { case msg := <-k.ms...

programming-language
golang
snippet
batch

GORM Update

Golang Troubleshooting

会忽略零值字段(默认值) type User struct { Name string Age int } db.Model(&user).Updates(User{Name: "Tom", Age: 0}) 这条语句中,Age: 0 会被忽略,因为 GORM 默认只更新非零值字段。 Solutions Model.Update(column, value) db.Model(&user).Update("age", 0) // 会把 age 更新为 0 使用 Map db.Model(&user...

gorm
programming-language
golang
update

Quick Start

PHP Composer

Installation https://getcomposer.org/download/ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e55...

programming-language
php
composer

Benchmark

PHP Laravel

ENV Ubuntu 22.04 2C2G/4C8G Response {"code":0,"message":"\u83b7\u53d6\u6210\u529f","data":{"total":10,"list":[{"id":1,"name":"\u6d4b\u8bd5\u7528\u62371","email":"test1@example.com","isVerified":true,"verifiedAt":"2025-04-08T09:22:52.000000Z","createdAt":"2...

wrk
benchmark
programming-language
php
laravel
frankenphp

Quick Start

PHP Laravel

Installation composer global require laravel/installer Errors Change Source. composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ New Project laravel new example-app php artisan migrate

programming-language
php
laravel

Virtual Environment

Python Manual

pyenv Installation brewn install pyenv echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc echo 'eval "$(pyenv init - zsh)"' >> ~/.zshrc Usage List versions pyenv insta...

programming-language
python
virtual
env

Logs Schema

OpenTelemetry Collector

Version 0.113.0 otel_logs CREATE TABLE otel_logs ( `Timestamp` DateTime64(9) CODEC(Delta(8), ZSTD(1)), `TimestampTime` DateTime DEFAULT toDateTime(Timestamp), `TraceId` String CODEC(ZSTD(1)), `SpanId` String CODEC(ZSTD(1)), `TraceFlags` ...

collector
opentelemetry
logs

BookStack Rocks

2025

The blog has finally migrated from VitePress to BookStack. During the migration, many modifications were made by Cursor, costing $0.08 per session 💰. VitePress Style The Markdown rendering style is basically consistent with the VitePress style. New List View...

bookstack
vitepress
markdown

settings.json

VSCode Configuration

Preferences: Open user settings inlayHints Remove value: field hint. "editor.inlayHints.enabled": false, References https://stackoverflow.com/questions/71873489/disable-field-name-description-in-vscode

Applications

Prometheus Metrics

在 Kubernetes 中,如果你想通过 Prometheus 获取 部署的应用信息(比如 Deployment、StatefulSet、Service 等),通常使用 kube-state-metrics 提供的以下指标。它会将 Kubernetes 对象的状态以指标暴露出来。 Service 相关指标(服务) kube_service_info 描述:K8s 中每个 Service 的基本信息 常用 label: exported_namespace(服务所在命名空间) exported_service...

Quick Start

Zadig

https://koderover.com/tutorials-detail/codelabs/t100/index.html#0 Installation Version 3.4.0 Resources: 2C/4G Add Repo helm repo add koderover-chart https://koderover.tencentcloudcr.com/chartrepo/chart helm repo update Get Node IP Get K8s node ip first. k...

zadig
quick-start

Commands

minikube Quick Start

Get Version minikube version List Cluster * is the current cluster. minikube profile list | Profile | Status | Minikube Version | ... |------------|-----------|------------------| | *minikube | Running | v1.33.1 | | mycluster | Stopped ...

Commands

Git Quick Start

List Remote git remote -v Set Remote git remote set-url origin git@github.com:user/repo.git

Metrics Server

minikube Addons

Enable minikube addons enable metrics-server Errors Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io) Check pod status. kubectl -n kube-system get pods | grep metrics-server metrics-serv...

Commands

Kafka Manual

Topic Consumer Group & Lag Use akw 'NR==2 || /topic-name/' to get header row. kafka-consumer-groups.sh --bootstrap-server localhost:9092 --all-groups --describe | awk 'NR==2 || /topic-name/' GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSU...

Communication Errors

MySQL Troubleshooting

Background ✅ MySQL can connect from its own pod. ❌ MySQL can't connect by K8s service. Service endpoint is right. getent inside pod, sometimes failed Pod network issue(Calico CNI). Errors JDBC Errorscom.mysql.cj.jdbc.exceptions.CommunicationsException: C...

Delete WAL For Launch

Prometheus Tricks

Sometimes readness probe will be timeout because of the large wal logs. If the data is not important, just delete it. kubectl exec -it xxx -- /bin/sh rm -rf /prometheus/wal/ kubectl rollout restart deploy/sts xxx

prometheus
wal
readness

Container Advisor

Prometheus Metrics

The following metrics needs cAdvisor job. container_cpu_usage_seconds_total container_network_receive_bytes_total container_network_transmit_bytes_total ... kubectl edit cm prometheus-configmap config map- job_name: 'kubelet' scheme: https metrics_path:...

Tailscale iptables with Aliyun DNS

Aliyun

Troubleshooting resolvectl status Global Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported resolv.conf mode: foreign DNS Domain: tail2fb681.ts.net Link 2 (eth0) Current Scopes: DNS Protocols: +DefaultRoute +LLMNR -mDNS -DNS...