加速github文件下载
github文件下载加速
github.com/hunshcn/gh-proxy.git 是我们要下载的地址,前缀https://去掉
git clone https://gitclone.com/github.com/hunshcn/gh-proxy.git
go get 超时, 使用以下方法解决
#linux 下
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
go get -u -v github.com/gin-gonic/gin
win10无法打开gihthub.com
https://www.cnblogs.com/liweimu/p/github_Access.html
1.电脑打开CMD窗口
2.ping github.com
3.复制其域名对应的IP,如 140.82.114.4
4.nodepad++打开: C:\Windows\System32\drivers\etc\hosts
添加如下代码
#github related website
140.82.114.4 github.com
140.82.114.4 gist.github.com
5.打开cmd输入ipconfig/flushdns刷新dns缓存
6.重新打开网站即可
http和rpc的区别
HTTP 就是一种 RPC,你通过一定的方法去调用 HTTP 服务器上的某个 procedure,执行完以后把结果返回给你。
有的时候我们嫌标准 HTTP 太慢/太复杂/不适合特定场景,那么就自己发明一个新的。
Python约瑟夫圆环的解法
现在有13个人围成一个环,从1开始报数,数到3的人离开,写出程序计算最后剩下的是谁
def josephus(alist, k=1, m=3):
# alist: 要循环的列表 [1, 2,3, 4,5]
# k: 从编号为k的人开始
# m: m为报数
if len(alist) > 1:
index, step = k - 1, m
index = (index + step -1) % len(alist)
alist.pop(index)
return josephus(alist, index+1, m)
else:
return alist[0]
斐波那契数列
def fib(num):
a, b = 0, 1
for i in xrange(num):
yield b
a, b = b, a+b
解决zsh: command not found: swag方法
问题:zsh: command not found: swag
方法:export PATH=$PATH:$HOME/go/bin
pip豆瓣源
[global]
timeout = 60
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
rm 递归删除某个文件夹下的.pyc文件
rm 递归删除test文件夹下的所有.pyc文件
find test/ -name *.pyc| xargs rm -rf