You are currently browsing the monthly archive for 1 月 2021.
pip install jupyterlab
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install –user
pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable –user
pip install anndata
pip install scanpy
pip install scvelo
pip install episcanpy
conda install -c conda-forge r-base=4.0.3
conda install -c conda-forge libgit2 or brew install libgit2 on mac
conda install -c conda-forge r-cairo
conda install -c conda-forge r-hdf5r
install.packages(c(“devtools”,”tidyverse”))
devtools::install_git(“https://gitee.com/chansigit/seurat.git”)
devtools::install_git(“https://gitee.com/chansigit/uwot.git”)
devtools::install_git(“https://gitee.com/chansigit/liger.git”)
devtools::install_git(“https://gitee.com/chansigit/seurat-wrappers.git”)
if (!requireNamespace(“BiocManager”, quietly = TRUE))
install.packages(“BiocManager”)
BiocManager::install(version = “3.12”)
BiocManager::install(c(
‘BiocGenerics’, ‘DelayedArray’, ‘DelayedMatrixStats’,
‘limma’, ‘S4Vectors’, ‘SingleCellExperiment’,’multtest’,
“SingleCellExperiment”,”GenomicRanges”,”scRNAseq”,
“Rhdf5lib”,”pcaMethods”,”DropletUtils”,”scater”,
“SingleR”,”geneplotter”,”AUCell”,”GSVA”,”ComplexHeatmap”,
“AnnotationHub”,’SummarizedExperiment’, ‘batchelor’, ‘Matrix.utils’,
“clusterProfiler”,”ChIPseeker”,”ChIPpeakAnno”))
拒绝内卷,出关开拓
我们往往会在内网上建立jupyter notebook、rstudio server等web服务,当我们希望将这些web服务放在公网上时,会遇到一些问题:比如内网机器虽然可以访问外部互联网,但是却没有公网IP地址,以至于无法在公网上连接到内网机器上去。
要解决这个问题,我们可以借助ssh端口转发技术,把内网机器上的web服务(比如运行在8888端口上的jupyter)转发到一台有公网IP的另一台机器上去,具体操作如下,我们再内网机器上运行:
ssh -C -N -R 0.0.0.0:12345:localhost:8888 chensijie@公网服务器IP -p22 \ -o TCPKeepAlive=yes -o ServerAliveInterval=30 -o StrictHostKeyChecking=no
运行完后,我们在另一台有公网IP的机器上就可以用localhost:12345来访问内网机器的8888 web服务端口了。
但这仍然不够,我们虽然能这台有公网IP的机器上访问内网机器的web服务了,但也仅限于在公网机器自己上可以用localhost:12345来访问,并没有把它发布出去,大众仍然不能用“公网服务器IP:端口号”的方式访问该web服务。这里我们就需要一个反向代理服务。这里我们使用mitmproxy建立该服务(安装方法参见[2])
mitmproxy -p 8080 --mode reverse:https://localhost:12345 --set block_global=false
运行完这些后,大众就可以用“公网服务器IP:端口号”的方式访问该web服务了。
参考资料:
[1]The simplest possible reverse proxy [closed] https://stackoverflow.com/questions/17107431/the-simplest-possible-reverse-proxy
This page introduced the mitmproxy based way of building a reverse proxy
[2]This page tells you how to install mitmproxy. Use hoembrew on mac, use pip or pipx on others. https://docs.mitmproxy.org/stable/overview-installation/
[3]If you hope to build a reverse proxy by yourself, find information at https://segmentfault.com/q/1010000000175242 or https://github.com/MollardMichael/python-reverse-proxy/blob/master/proxy.py
[4]Other ways achieving the same goals may be found at https://taigezhang.com/blog/2019/04/21/%E4%BD%BF%E7%94%A8frp%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F%E5%B9%B6%E8%BF%9C%E7%A8%8B%E8%BF%9E%E6%8E%A5Jupyter%20Notebook/
后记:
如果在使用mitmproxy的过程中出现 Cannot establish TLS with 192.168.88.128:8080 (sni: 192.168.88.128): TlsException(“SSL handshake error: Error([(‘SSL routines’, ‘ssl3_get_record’, ‘wrong version number’)],)”,)错误,将https换成http应该就可以解决问题。
如果报错HttpReadDisconnect(‘Server disconnected’), 那么请检查一下内网的web服务是否成功打开。
如果jupyter运行时,后台报错Blocking Cross Origin API request for /api/XXX,请在位于~/. jupyter/jupyter_notebook_config.py.配置文件中修改
c.NotebookApp.allow_origin = '*'
近期评论