2019年1月17日星期四

mac安装mysql

参考https://gist.github.com/operatino/392614486ce4421063b9dece4dfe6c21

Install brew services first : $ brew tap homebrew/services

Load and start the MySQL service : $ brew services start mysql@5.7
Expected output : Successfully started mysql (label: homebrew.mxcl.mysql)

Check of the MySQL service has been loaded : $ brew services list

Force link 5.7 version - $ brew link mysql@5.7 --force

Verify the installed MySQL instance : $ mysql -V

安装完成后mysql配置读取顺序默认为:/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf

找到相应的文件,修改配置,然后brew services restart mysql@5.7

2019年1月11日星期五

tensorflow的c++ so编译问题

tensorflow1.6的二进制包是用gcc4编译的,bazel在gcc5上使用到tensorflow的库的话编译会有问题,如下:


如果需要在gcc5上兼容tensorflow库,需要在编译选项中加上 bazel build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"

2018年12月17日星期一

2018年11月13日星期二

ssh agent的一点理解

之前一直使用一套publickey(xychen.pub)和private key(xychen),今天遇到了点问题。

很多时候 ssh-add .ssh/xychen 会报错:Could not open a connection to your authentication agent.

所以我会执行 eval `ssh-agent` 启动一个ssh agent,然后再ssh-add。但今天在服务器上执行该eval命令时候报错:mkdtemp: private socket dir: Read-only file system。所以ssh key没有添加成功。后来发现原因是系统磁盘有问题,无法写/tmp目录导致失败。

用ssh-keygen生成了一套key,默认是保存为 .ssh/id_rsa 和 .ssh/id_rsa.pub,将id_rsa.pub加入git的ssh配置后,也完全不需要 ssh-add 添加ssh key,就可以clone代码。或者把你自己之前的public和private key文件改成id_rsa.pub和id_rsa即可。

所以我删掉了刚才ssh-keygen生成的id_rsa两个文件,将xychen重命名为了id_rsa文件,xychen.pub是已经添加到git的ssh配置的。最后发现将.ssh/xychen重命名为了.ssh/id_rsa之后,也不需要ssh-add,就可以clone了。

结论:猜测ssh认证的时候会读取ssh agent被ssh-add进来的ssh key,也会读取.ssh/id_rsa这个private key,先后顺序就不知道了,总之两个都有用。

2018年11月7日星期三

mac安装pyenv报zlib的错

参考https://github.com/pyenv/pyenv/issues/25

ERROR: The Python zlib extension was not compiled. Missing the zlib?

设置CFLAGS:
CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 2.7

2018年10月31日星期三

ubuntu非root权限非chsh更改默认shell

参考https://blog.csdn.net/silent56_th/article/details/81367774

默认shell为sh,希望改为bash,修改~/.profile文件,增加两行如下:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
# modified for changing default shell to bash
else
    export SHELL=/bin/bash
    exec /bin/bash -l
fi

2018年10月17日星期三

mac彻底删除软件

以CleanMyMac为例,mdfind -name CleanMyMacX,然后删除所有列出的文件