Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
allownonascii=$(git config --bool hooks.allownonascii)
exec 1>&2
@GivenZeng
GivenZeng / .gitlab-ci.yml
Created November 13, 2019 11:46
golang ci
image: golang:1.11
# before_script:
# 代码格式化
fmt:
script:
# 代码格式化
- diff -u <(echo -n) <(gofmt $(find . -type f | grep -v vendor/ |grep -v /clients/ |grep -v /thrift_gen/ |grep -v kite.go|grep .go) )
- diff -u <(echo -n) <(goimports $(find . -type f | grep -v vendor/ |grep -v /clients/ |grep -v /thrift_gen/ |grep -v kite.go|grep .go) )
@GivenZeng
GivenZeng / outtime.go
Created July 9, 2018 14:36
golang 定时器
package main
import "time"
import "fmt"
func main() {
// 在这个例子中, 假设我们执行了一个外部调用, 2秒之后将结果写入c1
c1 := make(chan string, 1)
go func() {
time.Sleep(time.Second * 2)
c1 <- "result 1"
}()
@GivenZeng
GivenZeng / golang_continue.go
Created June 21, 2018 06:41
golang contine
package main
import "fmt"
func main() {
LOOP_TEST:
for j := 1; j < 3; j += 1 {
fmt.Println("loop1")
for i := 1; i < 3; i = i + 1 {
fmt.Println("loop2")
@GivenZeng
GivenZeng / my.cnf
Created March 11, 2018 14:13
mysql
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake
@GivenZeng
GivenZeng / util or framwork
Last active March 4, 2018 13:56
golang grpc
// grpc
go get github.com/golang/protobuf/proto
go get github.com/gogo/protobuf/protoc-gen-gofast
go get github.com/gogo/protobuf/proto
go get github.com/gogo/protobuf/gogoproto
go get google.golang.org/grpc
// usual
go get github.com/golang/glog
@GivenZeng
GivenZeng / .tmux.conf
Last active April 17, 2022 06:47
tmux
bind r source-file ~/.tmux.conf \; display-message "Config reloaded"
set -g @plugin 'tmux-plugins/tmux-yank'
set -g mouse on
#禁止 rename window
set-option -g allow-rename off
set -g status-keys vi
set -g history-limit 10000
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection;
@GivenZeng
GivenZeng / vim
Last active September 30, 2018 01:53
vim
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@GivenZeng
GivenZeng / python
Last active December 19, 2017 09:37
各开发语言的.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc
@GivenZeng
GivenZeng / gist:bef26019798220cdc9259fd4a6cb0a9c
Created December 11, 2017 08:29
golang 运行shell脚本
package main
import (
"bytes"
"fmt"
"log"
"os/exec"
)