#解决方案 Socks5 + Privoxy
思路就是, 建立一个本地sock5代理, 但因为go get 需要http代理, 所以需要使用privoxy把sock5代理转为http代理.
sudo apt-get install python-pip
#!/bin/sh | |
VERSION=0.8.6 | |
PLATFORM=darwin | |
ARCH=x64 | |
PREFIX="$HOME/node-v$VERSION-$PLATFORM-$ARCH" | |
mkdir -p "$PREFIX" && \ | |
curl http://nodejs.org/dist/v$VERSION/node-v$VERSION-$PLATFORM-$ARCH.tar.gz \ | |
| tar xzvf - --strip-components=1 -C "$PREFIX" |
class WxTransport extends roal.Transport { | |
constructor(options) { | |
super(); | |
this._buf = []; | |
this._serviceUUID = options.serviceUUID; | |
this._characteristicUUID = options.characteristicUUID; | |
this._deviceId = null; // 扫描连接后,更新此字段 | |
this.ready = this.setup(); | |
} | |
setup() { |
pushd /opt | |
sudo bash -c "wget https://github.com/sarfata/pi-blaster/archive/master.zip -O pi-blaster.zip" | |
sudo unzip pi-blaster.zip | |
if [ -d pi-blaster ]; then | |
sudo rm -fr pi-blaster | |
fi | |
sudo mv pi-blaster-master pi-blaster | |
cd pi-blaster | |
sudo ./autogen.sh |
# Pack the nodejs application using `pkg` (https://github.com/zeit/pkg) | |
# dependencies: rimraf, cpx and pkg | |
# > npm i rimraf cpx pkg -D | |
.PHONY: init clean build | |
OS := $(shell uname) | |
ARCH := $(shell uname -p) | |
all: dist |
# On a MAC, use: | |
nm *.o | c++filt |
static uint32_t seed = 0; | |
static void srand32(uint32_t s) { | |
seed = s; | |
} | |
static uint32_t rand32(void) { | |
seed = (uint32_t)(((uint64_t)1664525 * seed) + 1013904223); |
# http proxy | |
git config --global https.proxy http://127.0.0.1:1088 | |
git config --global https.proxy http://127.0.0.1:1088 | |
# socks5 proxy | |
git config --global http.proxy socks5://127.0.0.1:1080 | |
git config --global https.proxy socks5://127.0.0.1:1080 | |
# unset proxy | |
git config --global --unset http.proxy |
With Ruby 1.8 (default version on MacOS) :
sudo gem install json
curl -s https://api.github.com/orgs/[ORGANIZATION]/repos | ruby -rubygems -e 'require “json”; JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["ssh_url"]} ]}'
With Ruby 1.9+, the json library is by default thus you just use :