Archive

Archive for April, 2020

[zsh]oh-my-zsh插件git目录卡顿的情况处理

April 1st, 2020 No comments

oh-my-zsh在git目录下执行命令会卡顿明显,简单的cd和ls都会
经查是agnoster主题的问题,会读取git的配置信息,如果项目目录下有太多的文件,卡顿会非常明显。
果然美观和性能最后都是二选一

可以使用以下命令禁止zsh自动获取git信息,解决卡顿问题

git config --global oh-my-zsh.hide-status 1

如果针对单个目录,可以在 git 项目目录执行

设置 oh-my-zsh 不读取文件变化信息

git config --add oh-my-zsh.hide-dirty 1

可以再设置 oh-my-zsh 不读取任何 git 信息

git config --add oh-my-zsh.hide-status 1

参考
https://my.oschina.net/u/614511/blog/646012

Categories: 零敲碎打 Tags:

[Ubuntu] Ubuntu17.04 安装curl

April 1st, 2020 No comments

Ubuntu 17.04 安装完毕后,没有curl,需要手动安装curl

sudo apt-get install curl

报错:没有这个软件、

尝试使用添加ppa方式,结果Ubuntu 17.04下无效

sudo add-apt-repository ppa:costamagnagianfranco/ettercap-stable-backports 
sudo apt-get update 
sudo apt-get install curl

最后改为使用源代码方式安装
源代码

#下载
wget https://curl.haxx.se/download/curl-7.58.0.tar.gz
#解压
tar xvf curl-7.58.0.tar.gz
#配置
cd curl-7.58.0
./configure
#编译
make
#安装
sudo make install

奇怪的是Ubuntu17.04 上 libcurl是有的,为啥去掉curl,不知道基于何种考虑

Categories: 系统管理, 零敲碎打 Tags:

[Docker]Nginx出现 is not served on this interface问题

April 1st, 2020 No comments

[Docker]Nginx出现 is not served on this interface问题

很多云服务商的VPS,比如阿里云 ECS/ AWS EC2都默认开启了ipv6支持。使用docker跑nginx官方容器时,如果网络配置不当会出现

404 Site 172.17.0.x is not served on this interface

一般是因为服务器同时启用了ipv6和ipv4,按需要关闭一个,如果同时启用的话,需要单独处理一下

# 使用ipv6,隐式向下兼容ipv4

 server{
     listen  [::]:80   default ipv6_only=on;
     server_name   _ ;
 }

同时启用ipv6和ipv4,显式向下兼容

# 同时启用ipv6和ipv4,显式向下兼容
 server{
     listen       80   default;
     listen  [::]:80   ipv6_only=on;
     server_name   _ ;
 }

只使用ipv4,不兼容ipv6

# 只使用ipv4,不兼容ipv6
 server{
     listen    80   default;
     server_name   _ ;
 }

关闭docker 的IPv6支持, 这里不推荐使用

vi /etc/docker/daemon.json


/etc/docker/daemon.json
增加关闭ipv6的设置

{
...
ipv6='False',
......
}

404 Site 172.17.0.x is not served on this interface

Categories: 系统管理 Tags:

Tensorboard几个使用技巧

April 1st, 2020 No comments

1.Tensorboard需要对比多个Training的数据
常规的做法现实单次训练的数据,–logdir=path

tensorboard --logdir=path

多个Training的数据对比,则需要规定各个run的名称

tensorboard --logdir=run1:“path1",run2:“path2",run3:“path3"

2.Tensorboard强制使用CPU
GPU被占满的时候,只能使用CPU来渲染Tensorboard的数据,具体做法是在启动命令前增加CUDA_VISIBLE_DEVICES=“”

CUDA_VISIBLE_DEVICES=“" tensorboard --logdir=path

3.Tensorboard提示No dashboards are active for the current data
一般发生在Tensorboard切换版本后,–logdir=后面不要接带单引号的路径,如果路径包含空格,转意或使用双引号

# 错误
tensorboard —logdir=‘path'
# 正确
tensorboard --logdir=path

tensorboard完整的命令参数

usage: tensorboard [-h] [--helpfull] [--logdir PATH] [--host ADDR]
                   [--port PORT] [--purge_orphaned_data BOOL]
                   [--reload_interval SECONDS] [--db URI] [--db_import]
                   [--db_import_use_op] [--inspect] [--version_tb] [--tag TAG]
                   [--event_file PATH] [--path_prefix PATH]
                   [--window_title TEXT] [--max_reload_threads COUNT]
                   [--reload_task TYPE]
                   [--samples_per_plugin SAMPLES_PER_PLUGIN]
                   [--debugger_data_server_grpc_port PORT]
                   [--debugger_port PORT] [--master_tpu_unsecure_channel ADDR]
Categories: 语言编程 Tags:

[WP] 升级WordPress5.x以后Nginx伪静态设置

April 1st, 2020 No comments

[WP] 升级Wordpress 5.x以后Nginx伪静态设置

升级Wordpress 5.x 以前,Nginx的伪静态设置方法。

location / {
if (-f $request_filename/index.html){
                rewrite (.*) $1/index.html break;
        }
if (-f $request_filename/index.php){
                rewrite (.*) $1/index.php;
        }
if (!-f $request_filename){
                rewrite (.*) /index.php;
        }
}

WordPress 5.x 以后,Nginx的伪静态设置方法,
当然,nginx本身是提供向前兼容的,使用哪种方式按需设置即可。

location / {
	try_files $uri $uri/ /index.php?$args;
}
 
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

对于wp-admin的伪静态设置, WordPress 无论是否升级 5.x都是一样的。

  if (!-e $request_filename) {
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
        rewrite ^(/[^/]+)?(/wp-.*) $2 last;
        rewrite ^(/[^/]+)?(/.*\.php) $2 last;
  }

官方文档地址

Nginx

Categories: 博客技巧, 系统管理 Tags: