pip如何使用清华源
临时使用#
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package注意,simple 不能少, 是 https 而不是 http
设为默认#
升级 pip 到最新的版本 (>=10.0.0) 后进行配置:
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
设置git使用代理
git主要使用两种协议:HTTPS和ssh。需要分别设置代理。
为git设置HTTPS代理:
git config --global http.proxy "socks5h://127.0.0.1:1080"
# 仅为github设置代理:
git config --global http.https://github.com.proxy socks5h://127.0.0.1:1080为git设置SSH代理有两种思路方法:
Host github.com
User git
# 使用nc,ssh走代理
ProxyCommand nc -v -x 127.0.0.1:1080 %h %p
# 使用vps作为ssh跳板做代理
ProxyCommand ssh -q -W %h:%p vps同时,Github支持SSH over HTTPS,即:
Using SSH over the HTTPS port。
通过如下设置:
Host github.com
Hostname ssh.github.com
Port 443SSH协议流量走HTTPS协议。
再继续设置终端https代理即可。(目前访问ssh.github.com这个域名似乎没什么问题)
终端设置代理
export ALL_PROXY=socks5h://127.0.0.1:1080更换docker仓库镜像
from Registry as a pull through cache
The first time you request an image from your local registry mirror, it pulls the image from the public Docker registry and stores it locally before handing it back to you. On subsequent requests, the local registry mirror is able to serve the image from its own storage.
对于使用systemd的系统,编辑/etc/docker/daemon.json:
{
"registry-mirrors": [
"https://docker.mirrors.ustc.edu.cn",
"https://dockerhub.azk8s.cn",
"https://hub-mirror.c.163.com"
]
}接着重启服务:
sudo systemctl daemon-reload
sudo systemctl restart docker就可以用docker info查看是否更改。
ssh客户端保活
Host *
ServerAliveInterval 60
TCPKeepAlive yesgit更新子模块
git submodule update --remoteUbuntu如何新增sudo用户
sudo adduser <username>sudo usermod -aG sudo <username>
查看当前目录下不同后缀名各有多少文件
$ find . -type f | sed -e 's/.*\.//' | sed -e 's/.*\///' | sort | uniq -c | sort -rn
1722 jpg
986 jpeg
19 png
16 webpFrom stackoverflow.