Skip to content

Instantly share code, notes, and snippets.

View AntiKnot's full-sized avatar
🎯
Focusing

xxx.Yan AntiKnot

🎯
Focusing
View GitHub Profile
@AntiKnot
AntiKnot / add_to_zshrc.sh
Created August 26, 2024 02:01 — forked from karpathy/add_to_zshrc.sh
Git Commit Message AI
# -----------------------------------------------------------------------------
# AI-powered Git Commit Function
# Copy paste this gist into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It:
# 1) gets the current staged changed diff
# 2) sends them to an LLM to write the git commit message
# 3) allows you to easily accept, edit, regenerate, cancel
# But - just read and edit the code however you like
# the `llm` CLI util is awesome, can get it here: https://llm.datasette.io/en/stable/
gcm() {
@AntiKnot
AntiKnot / backup.sh
Created March 4, 2022 04:15
how to backup clickhouse database table
clickhouse client --host 127.0.0.1 --port 9000 --query="select * from DatabaseName.TableName1 FORMAT CSV" > /opt/clickhouse/backup/DatabaseName.TableName1.csv
clickhouse client --host 127.0.0.1 --port 9000 --query="select * from DatabaseName.TableName2 FORMAT CSV" > /opt/clickhouse/backup/DatabaseName.TableName2.csv
clickhouse client --host 127.0.0.1 --port 9000 --query="select * from DataBaseName.TableName3 FORMAT CSV" > /opt/clickhouse/backup/DataBaseName.TableName3.csv
@AntiKnot
AntiKnot / unbuffered-block.go
Last active January 20, 2022 08:59
go channel is sync
package main
func main() {
ch := make(chan bool)
ch <- true
<-ch
}
@AntiKnot
AntiKnot / ptr.go
Created January 17, 2022 06:39
go pointer
package main
import "fmt"
//func double(n int) {
// n += n
//}
func double(n *int) {
*n += *n

go rpc demo

register master struct, all its function can be called.

@AntiKnot
AntiKnot / file_helper.go
Created January 16, 2022 14:21
go read and write file; IO file
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
)
func check(e error, s string) {
@AntiKnot
AntiKnot / Makefile
Created January 16, 2022 03:07
go Plugin demo
build:
go build -buildmode=plugin arithmetic.go
go build calculate.go
run:
./calculate
@AntiKnot
AntiKnot / Makefile
Created January 9, 2022 15:00
sample-go-rpc
run-server:
go run server/server.go
run-client:
go run client/client.go