moon published posts

走火入魔三

生命体与非生命体之间没有不可跨越的界限。
可以通过人工方式编码到脑中来生成生命体的记忆,信息也可以储存在人造的有机储存器中。

- Read More -

走火入魔二

生命体能够进行复杂的动作,产生复杂的想法,是由于体内复杂的有机器官。众所周知,生命体的遗传物质有DNA,部分病毒主要依靠RNA传递遗传信息,体内功能的发生依靠种类繁多、结构复杂的蛋白质。

生物学或者化学上有许多人工方法快速复制DNA、RNA,也有许多方法产生蛋白质。

- Read More -

Error installing mysql-python/mysqlclient: library not found for -lssl

macOS Mojave 安装mysqlclient时提示没有ssl库,错误如下:

Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient ... error
    Complete output from command /Users/moon/Workspace/Pycharm/env-tonghang/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6z/3d8pkqg53r72hd3gvt71n0900000gn/T/pip-install-dk68k229/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/6z/3d8pkqg53r72hd3gvt71n0900000gn/T/pip-record-4eo9tbll/install-record.txt --single-version-externally-managed --compile --install-headers /Users/moon/Workspace/Pycharm/env-tonghang/include/site/python3.6/mysqlclient:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.13-x86_64-3.6
    copying _mysql_exceptions.py -> build/lib.macosx-10.13-x86_64-3.6
    creating build/lib.macosx-10.13-x86_64-3.6/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb
    copying MySQLdb/compat.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb
    creating build/lib.macosx-10.13-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.13-x86_64-3.6/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.macosx-10.13-x86_64-3.6
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,3,12,'final',0) -D__version__=1.3.12 -I/usr/local/opt/mysql@5.7/include/mysql -I/Users/moon/Workspace/Pycharm/env-tonghang/include -I/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c _mysql.c -o build/temp.macosx-10.13-x86_64-3.6/_mysql.o
    clang -bundle -undefined dynamic_lookup build/temp.macosx-10.13-x86_64-3.6/_mysql.o -L/usr/local/opt/mysql@5.7/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.13-x86_64-3.6/_mysql.cpython-36m-darwin.so
    ld: library not found for -lssl
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'clang' failed with exit status 1
    
    ----------------------------------------
Command "/Users/moon/Workspace/Pycharm/env-tonghang/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6z/3d8pkqg53r72hd3gvt71n0900000gn/T/pip-install-dk68k229/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/6z/3d8pkqg53r72hd3gvt71n0900000gn/T/pip-record-4eo9tbll/install-record.txt --single-version-externally-managed --compile --install-headers /Users/moon/Workspace/Pycharm/env-tonghang/include/site/python3.6/mysqlclient" failed with error code 1 in /private/var/folders/6z/3d8pkqg53r72hd3gvt71n0900000gn/T/pip-install-dk68k229/mysqlclient/

Screen Shot 2019-06-19 at 14.06.27.png

解决方法可以指定ssl库

LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient

或在~/.bash_*中指定环境

export LDFLAGS="-L/usr/local/opt/openssl/lib"

To StackoverflowError installing mysql-python: library not found for -lssl

Unnamed document

食言、信口开河将会对两人的关系造成不可弥补的破坏,甚至也许是关系破裂的开始。
我希望永远不要再这样了,对自己爱的人。

宝贝生日快乐

陪宝贝度过的第一个生日

哭哭啼啼的度过了

宝贝为了让我好好睡觉,假装开心的陪我到这么晚,她应该还会去看一会儿小埋才肯去睡

宝贝情感洁癖严重,希望下辈子能让宝贝慢慢释怀

很爱你,宝贝,愿意跟你不离不弃

Modifying SElinux configure for allowing nginx reverse proxy local site

Read about audit2allow and used it to create a policy to allow access to the denied requests for nginx.

    [root]# sudo cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -m nginxlocalconf > nginxlocalconf.te
    [root]# cat nginxlocalconf.te 
    
    module nginxlocalconf 1.0;
    
    require {
        type httpd_t;
        type var_t;
        type transproxy_port_t;
        class tcp_socket name_connect;
        class file { read getattr open };
    }
    
    #============= httpd_t ==============
    
    #!!!! This avc can be allowed using the boolean 'httpd_can_network_connect'
    allow httpd_t transproxy_port_t:tcp_socket name_connect;
    allow httpd_t var_t:file { read getattr open };
    [root]# sudo cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M nginxlocalconf
    ******************** IMPORTANT ***********************
    To make this policy package active, execute:
    
    semodule -i nginxlocalconf.pp
    
    [root]# semodule -i nginxlocalconf.pp

To allow http server to connect local DB, like mysql, do as fllows:

# setsebool -P httpd_can_network_connect 1
# setsebool -P httpd_can_network_connect_db 1

To allow nginx(or apache, php-fpm, etc...) to write/read some dir, do as fllows:

semanage fcontext -a -t httpd_sys_rw_content_t "/path(/.*)?"
restorecon -r /path

see kuddusic.wordpress.com


How to fix permission denied under Linux with SELinux:
update-wordpress-with-selinux-enabled
install-wordpress-centos-7