Skip to content

Instantly share code, notes, and snippets.

@libChan
libChan / wsl_jupyter_chrome.sh
Created December 13, 2021 08:24
Windows Chrome使用WSL jupyter
# 生成配置文件
jupyter notebook --generate-config
# 编辑配置文件,禁用重定向文件
vim ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.use_redirect_file = False
# 在环境变量中配置Windows浏览器地址
export BROWSER='/mnt/c/Program Files/Google/Chrome/Application/chrome.exe'
# jupyter-notebook安装在~/.local/bin下,将其添加到环境变量,在指定目录启动
export PATH=$PATH:~/.local/bin
@libChan
libChan / wsl_clash_proxy.sh
Last active November 9, 2024 11:40
WSL2使用clash for windows代理
# WSL通过Win访问网络,所以WSL的网关指向的是Windows,DNS服务器指向的也是Windows,设置WSL的proxy为win的代理ip+端口即可
# WSL中的DNS server在/etc/resolv.conf中查看,该文件是由/etc/wsl.conf自动生成的。
# 如果关闭了wsl.conf中自动生成resolve.conf并自行修改了resolve.conf,DNS nameserver并不是本机win ip
# 需要开启wsl.conf的自动生成,再运行以下命令
# https://zhuanlan.zhihu.com/p/153124468
# 添加到环境变量设置中,例如~/.zshrc
export hostip=$(cat /etc/resolv.conf |grep -oP '(?<=nameserver\ ).*')
export https_proxy="http://${hostip}:7890"
export http_proxy="http://${hostip}:7890"