Skip to content

Instantly share code, notes, and snippets.

View abserari's full-sized avatar
🐱
Let's build a better world

DingRui Yang abserari

🐱
Let's build a better world
View GitHub Profile
@abserari
abserari / CLAUDE.md
Last active August 22, 2025 06:42
linus 提示词加强 for go

角色定义

你是 Linus Torvalds,Linux 内核的创造者和首席架构师。你已经维护 Linux 内核超过30年,审核过数百万行代码,建立了世界上最成功的开源项目。现在我们正在开创一个新项目,你将以你独特的视角来分析代码质量的潜在风险,确保项目从一开始就建立在坚实的技术基础上。

我的核心哲学

1. "好品味"(Good Taste) - 我的第一准则 "有时你可以从不同角度看问题,重写它让特殊情况消失,变成正常情况。"

  • 经典案例:链表删除操作,10行带if判断优化为4行无条件分支
  • 好品味是一种直觉,需要经验积累
// sendHeadRequest 发送单个HEAD请求用于连接保活
// 返回值: (成功, 请求持续时间, 错误信息)
func (sm *Manager) sendHeadRequest(
ctx context.Context,
sessionKey string,
session *coreSession.UserSession,
httpClient *http.Client,
requestBuilder *httprequest.Builder,
requestTimeout time.Duration,
requestIndex int,
#!/bin/env bash
# Dependencies: tesseract-ocr flameshot imagemagick xclip
#Name: OCR Picture
#Fuction: take a screenshot and OCR the letters in the picture
#Path: /home/Username/...
#you can only scan one character at a time
SCR="/home/Username/pictures/SCR"
@abserari
abserari / install.go
Created November 21, 2022 09:09
Go Install Binary Program in Dapr
// installBinary installs the daprd, placement or dashboard binaries and associated files inside the default dapr bin directory.
func installBinary(version, binaryFilePrefix, githubRepo string, info initInfo) error {
var (
err error
filepath string
)
dir := defaultDaprBinPath()
if isAirGapInit {
filepath = path_filepath.Join(info.fromDir, *info.bundleDet.BinarySubDir, binaryName(binaryFilePrefix))
@abserari
abserari / Profile Metrics
Last active July 5, 2023 16:05
Profile Metrics
Placeholder
@abserari
abserari / Makefile
Last active June 23, 2022 01:17
Makefile Template from Temporal
default: help
##@ Main targets
install: update-tools ## Install all tools and builds binaries.
bins: ## Rebuild binaries (used by Dockerfile).
all: update-tools clean proto bins check test ## Install all tools, recompile proto files, run all possible checks and tests (long but comprehensive).
ci-build: update-tools shell-check check proto mocks gomodtidy ensure-no-changes ## Used by Buildkite.
@abserari
abserari / map-equal.go
Created March 9, 2022 03:21
golang map equal
func equal(x, y map[string]int) bool {
if len(x) != len(y) {
return false
}
for k, xv := range x {
if yv, ok := y[k]; !ok || yv != xv {
return false
}
}
return true
@abserari
abserari / drag_and_drop.dart
Created May 10, 2021 15:30
Drag to Generate Flutter UI
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
@abserari
abserari / README.md
Created March 16, 2021 15:04
how the texas poker win or not
@abserari
abserari / visitor.go
Created March 12, 2021 00:33
visitor model
package visitor
import (
"context"
"errors"
"github.com/silverswords/pulse/pkg/message/retry"
"github.com/silverswords/pulse/pkg/message/timingwheel"
"log"
"time"
)