Skip to content

Instantly share code, notes, and snippets.

https://vincent.bernat.ch/en/blog/2019-makefile-build-golang
local tokens_key = KEYS[1] -- request_rate_limiter.${id}.tokens 令牌桶剩余令牌数的KEY值
local timestamp_key = KEYS[2] -- 令牌桶最后填充令牌时间的KEY值
local rate = tonumber(ARGV[1]) -- replenishRate 令令牌桶填充平均速率
local capacity = tonumber(ARGV[2]) -- burstCapacity 令牌桶上限
local now = tonumber(ARGV[3]) -- 得到从 1970-01-01 00:00:00 开始的秒数
local requested = tonumber(ARGV[4]) -- 消耗令牌数量,默认 1
local fill_time = capacity/rate -- 计算令牌桶填充满令牌需要多久时间
local ttl = math.floor(fill_time*2) -- *2 保证时间充足
https://github.com/mailgun/gubernator
https://github.com/nereuschen/blog/issues/37
https://whatis.techtarget.com/definition/leaky-bucket-algorithm
https://studygolang.com/articles/13167
https://www.iteye.com/blog/jinnianshilongnian-2305117
https://www.iteye.com/blog/manzhizhen-2311691
https://github.com/yueshutong/SnowJena/blob/master/CN_README.md
https://cloud.tencent.com/developer/article/1455478
https://mp.weixin.qq.com/s?__biz=MzI0MTk0NTY5MA==&mid=2247483711&idx=1&sn=28780c8b26f24ac6314ff5c599bb622c&chksm=e9029c0ade75151c353cd6b720ce438b4342afd8ef3a7d03c61712554c6a000ac3646bbc3124&scene=38#wechat_redirect
https://zhuanlan.zhihu.com/p/31484931
* 查看分支merge操作涉及的相关修改详情
git show -m <commit>
`Note also that you can give the -m option to any of these commands to
force generation of diffs with individual parents of a merge.`
git diff commit commit^
hpts -s 127.0.0.1:1080 -p 8080
http_proxy=http://127.0.0.1:8080 https_proxy=http://127.0.0.1:8080
@jintao-zero
jintao-zero / Makefile.md
Created June 20, 2018 08:49 — forked from subfuzion/Makefile.md
Makefile for Go projects

Go has excellent build tools that mitigate the need for using make. For example, go install won't update the target unless it's older than the source files.

However, a Makefile can be convenient for wrapping Go commands with specific build targets that simplify usage on the command line. Since most of the targets are "phony", it's up to you to weigh the pros and cons of having a dependency on make versus using a shell script. For the simplicity of being able to specify targets that can be chained and can take advantage of make's chained targets,

@jintao-zero
jintao-zero / git
Created June 13, 2018 06:27
command about git
1、获取分支对应的远端分支
git branch -vv
git remote show origin
2、获取两个分支的差别
git log A..B // show commit in B, not in A
dig +short myip.opendns.com @resolver1.opendns.com
alias wanip='dig +short myip.opendns.com @resolver1.opendns.com'
https://unix.stackexchange.com/questions/22615/how-can-i-get-my-external-ip-address-in-a-shell-script
wget http://download.redis.io/redis-stable.tar.gz && tar xvzf redis-stable.tar.gz && cd redis-stable && make install
@jintao-zero
jintao-zero / batch_iconv.sh
Created November 27, 2017 02:18
iconv a directory
#!/usr/bin/env sh
echo 'start iconv...'
dir=$1
echo ${dir}
for f in ${dir}/*
do
echo ${f}
name=`basename ${f}`
echo ${name}
`iconv -f gbk -t utf8 ${f} > /tmp/${name}`