Speed up your internet connection in China
As a developer, you love fast internet connection, right? But here in China lots international services are slow, here is what you can do to make your life easier:
Use Shadowsocks
Why? It's faster than VPN. It's recommended to install Shadowsocks server on your VPS. Refer to wiki to learn about how to set up the servers and clients.
SoftEther for VPN
Sometimes Shadowsocks doesn't work, for example, I found Firebase iOS SDK doesn't work behind Shadowsocks proxy. Since I only use VPN once in a while, I don't want to pay a monthly fee for a VPN service. After tried various ways, SoftEther works for me.
Git proxy
Set Shadowsocks proxy for Git to speed up your Git.
Execute the commands in:
git config --global https.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
Or add this in ~/.gitconfig
:
[http]
proxy = socks5://127.0.0.1:1080
[https]
proxy = socks5://127.0.0.1:1080
You can also set environment variables to disable the proxy for some urls:
export no_proxy=.my.company,localhost,127.0.0.1
ProxyChains-NG
Use ProxyChains-NG for command-line tools to use Shadowsocks proxy, such as curl, wget, git.
brew install proxychains-ng
Use mirrors servers for package managers
The default servers for various package managers are slow in China, you need to switch to domestic ones.
CocoaPods
git config --global url."https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs".insteadOf "https://github.com/CocoaPods/Specs"
References:
- https://mirror.tuna.tsinghua.edu.cn/help/CocoaPods/
- https://github.com/CocoaPods/CocoaPods/issues/4997#issuecomment-193757909
RubyGems
gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
References:
https://gems.ruby-china.org/
PIP
vi ~/.pip/pip.conf
[global]
trusted-host = mirrors.aliyun.com
index-url = http://mirrors.aliyun.com/pypi/simple
NPM
npm install -g cnpm --registry=https://registry.npm.taobao.org
References:
https://npm.taobao.org/