2018年1月8日 星期一

Proxy


add-apt-repository-wont-work-on-proxy

$ sudo vim /etc/apt/apt.conf

Acquire::http::proxy "http://localhost:9999";
Acquire::ftp::proxy "ftp://localhost:9999";
Acquire::https::proxy "https://localhost:9999";

sudo visudo
then add the following lines
Defaults env_keep="http_proxy"
Defaults env_keep="https_proxy"
then:
sudo bash
export https_proxy=http://[username:password@]www.proxy.com:8000/
add-apt-repository ppa:


sudo -E add-apt-repository ppa:webupd8team/java

conda proxy

put .condarc file in home folder
proxy_servers:
    http: http://user:pass@corp.com:8080
    https: https://user:pass@corp.com:8080

git proxy

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

docker proxy
Creating Proxy Configuration
  1. Create a new directory for our Docker service configurations.
    sudo mkdir -p /etc/systemd/system/docker.service.d
  2. Create a file called proxy.conf in our configuration directory.
    sudo vi /etc/systemd/system/docker.service.d/proxy.conf
  3. Add the following contents, changing the values to match your environment.
    [Service]
    Environment="HTTP_PROXY=http://myproxy.hostname:8080"
    Environment="HTTPS_PROXY=https://myproxy.hostname:8080/"
    Environment="NO_PROXY=localhost,127.0.0.1,::1"
  4. Save your changes and exit the text editor.
  5. Reload the daemon configuration.
    sudo systemctl daemon-reload
  6. Restart Docker to apply our changes.
    sudo systemctl restart docker.service
Set transformers, sentencetransformers download model proxy
import os
os.environ['http_proxy']='your proxy'
os.environ['https_proxy']='your proxy'

在公司環境下使用GOlang with VSCODE設置 Proxy(CMD 或 PowerShell 擇一)


1、(與下擇一)使用管理者權限的 CMD 改 proxy 環境變數
> go env -w GOPROXY=https://proxy.golang.org,direct
> setx http_proxy http://xx.xx.xx.88:8080
> setx https_proxy http://xx.xx.xx.88:8080


1、(與上擇一)使用管理者權限的 Powershell 改 proxy 環境變數
> go env -w GOPROXY=https://proxy.golang.org,direct
> [Environment]::SetEnvironmentVariable("http_proxy", "http://xx.xx.xx.88:8080", 'User')
> [Environment]::SetEnvironmentVariable("https_proxy", "http://xx.xx.xx.88:8080", 'User')


2、最後要將 Visual Studio Code 重新開啟


Reference:
https://askubuntu.com/questions/92464/add-apt-repository-wont-work-on-proxy
https://stackoverflow.com/questions/31099279/running-conda-with-proxy
https://stackoverflow.com/questions/783811/getting-git-to-work-with-a-proxy-server
https://www.serverlab.ca/tutorials/containers/docker/how-to-set-the-proxy-for-docker-on-ubuntu/
https://docs.docker.com/config/daemon/systemd/
https://stackoverflow.com/questions/65913053/how-to-set-proxy-in-sentencetransformers

沒有留言:

張貼留言