2017年6月8日星期四

ssh通过跳板机来登录集群机器,配置免密码登录的方法

1. 在本机生成RSA公钥私钥
ssh-keygen
一直回车,会在~/.ssh/目录下生成id_rsa、id_rsa.pub两个文件

2. 拷贝id_rsa.pub文件中的内容到跳板机和你需要登录的机器的~/.ssh/authorized_keys文件中

3. 在本机~/.ssh/config中增加内容(注释要删除):
Host jumpserver    //跳板机别名
  HostName jumpserver_ip  //跳板机地址
  User your_username  //用户名
  Port xxx  //跳板机ssh端口
Host hostname  //需要登录的服务器别名
  HostName x.x.x.x  //服务器地址
  User your_username  //服务器的用户名
  ProxyCommand ssh -i ~/.ssh/id_rsa -q -W %h:%p jumpserver //跳板机PoryxCommand

在本机ssh hostname,即可登录。

luarocks install cunn报错

Error: Failed installing dependency: https://raw.githubusercontent.com/torch/rocks/master/cutorch-scm-1.rockspec - Build error: Failed building.
和这个issue同样的问题:https://github.com/torch/cunn/issues/113

因为没有安装cuda,参考https://github.com/facebook/fbcunn/blob/master/INSTALL.md#install-cuda

2017年6月2日星期五

docker ps查看完整的command

参考https://stackoverflow.com/questions/27380641/see-full-command-of-running-stopped-container-in-docker

docker ps -a --no-trunc

vim中合并行

命令J可以将本行和下一行合并为一行,同时用空格分隔这两行。我们也可以使用数字前缀来合并多行。例如3J会将当前行及之后的三行合并为一行。

通过设置joinspace选项,可以控制合并两行时的分隔符(如果一行是以标点符号来结尾)。如果设置:set nojoinspaces,用J命令合并两行时会用一个空格来分隔;如果设置:set joinspaces,用J命令合并两行时会用两个空格来分隔。如果不希望用空格来分隔合并的行,可以使用gJ命令。

参考http://yyq123.blogspot.hk/2010/07/vim-line-feed.html

2017年5月31日星期三

chmod递归分设置文件和文件夹权限

find your_path -type f -exec chmod 644 {} \;
find your_path -type d -exec chmod 755 {} \;

2017年5月25日星期四

ubuntu中使用intellij时ctrl+alt+b快捷键冲突

因为装了搜狗输入法,设置 -> 高级 -> 打开Fcitx设置,Global Config中Show Advance Option,找到Switching Vitual Keyboard,点击ctrl+alt+b,按esc取消快捷键设置,完成。

mac中brew link Error

Error: Cowardly refusing to 'sudo brew link'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

ll /usr/local/bin | grep brew
-rwxr-xr-x  1 chenxiaoyu  admin   656B Mar 11  2016 brew

将brew用户改为root:
sudo chown root:admin /usr/local/bin/brew
然后运行sudo brew link xxx,解决。