Archives: Notes

Install SSL certificate

I wanted to install Let’s Encrypt ssl certificate on my Centos 7 Aliyun server. After encountering so many errors, using the method on Centos 6, I finally installed it. wget https://dl.eff.org/certbot-auto chmod a+x ./certbot-auto ./certbot-auto Then, set up auto-renew. sudo vi /usr/lib/systemd/system/certbot.service [Unit] Description=Lets Encrypt renewal [Service] Type=oneshot ExecStart=/usr/bin/certbot renew –quiet –agree-tos sudo vi /usr/lib/systemd/system/certbot.timer • Read More »


中文分词工具的比较

五款中文分词工具的比较,尝试的有jieba,SnowNLP,thulac(清华大学自然语言处理与社会人文计算实验室),StanfordCoreNLP,pyltp(哈工大语言云),环境是Win10,anaconda3.7 安装 Jieba: pip install jieba SnowNLP: pip install snownlp thulac: pip install thulac StanfordCoreNLP: pip install stanfordcorenlp 下载CoreNLP并解压,将中文包下载并解压至CoreNLP文件夹 pyltp: pip install pyltp,安装失败提示c++14 missing,手动编译失败,换成centos安装依然失败,最终因为安装太麻烦放弃 运行 a = ‘Jimmy你怎么看’ import jieba.posseg as pseg ws = pseg.cut(a) for i in ws:     print(i) import thulac thu1 = thulac.thulac() text = thu1.cut(a) print(text) from stanfordcorenlp import StanfordCoreNLP nlp • Read More »


Centos block IPs failed many times

来自 https://yq.aliyun.com/articles/624167?spm=a2c4e.11155435.0.0.49c63312Ds2gU9 vi /usr/local/bin/secure_ssh.sh #! /bin/bash cat /var/log/secure|awk ‘/Failed/{print $(NF-3)}’|sort|uniq -c|awk ‘{print $2″=”$1;}’ > /usr/local/bin/black.list for i in `cat /usr/local/bin/black.list` do IP=`echo $i |awk -F= ‘{print $1}’` NUM=`echo $i|awk -F= ‘{print $2}’` if [ ${#NUM} -gt 1 ]; then grep $IP /etc/hosts.deny > /dev/null if [ $? -gt 0 ];then echo “sshd:$IP:deny” >> /etc/hosts.deny fi • Read More »


Mongodb

yum -y update 编辑Mongodb安装源 vim /etc/yum.repos.d/mongodb-org-3.6.repo 编辑内容如下: [mongodb-org-3.6] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc 安装 yum install -y mongodb-org 修改mongodb配置文件 vim /etc/mongod.conf systemctl start mongod.service //启动服务 systemctl stop mongod.service //停止服务 systemctl restart mongod.service //重启服务 删除安装的包yum erase $(rpm -qa | grep mongodb-org) 删除数据及日志 rm -r /var/log/mongodb rm -r /var/lib/mongo   更多内容参考: https://www.jianshu.com/p/d09506c64fcd https://www.cnblogs.com/hackyo/p/7967170.html


Centos创建以太坊私有链

首先第一部当然是更新,然后使用yum命令安装golang语言 yum –y updateyum install golanggit clone https://github.com/ethereum/go-ethereum.git  cd go-ethereum  make allcd go-ethereummake all 这里出现了编译错误,提示go的版本1.8.3,编译需要最少1.9。前往https://www.golangtc.com/download goland中国下载go1.10.1.linux-amd64.tar.gz,再次安装前需要卸载原有的golang,yum –y remove golang tar -C /usr/local -xzf go1.10.1.linux-amd64.tar.gzexport PATH=$PATH:/usr/local/go/bin 重复make,在go-ethereum/build/bin使用ll命令,会罗列文件夹内的在go-ethereum/build/bin目录下创建init.json的文本文件,内容如下: {  “config”: {        “chainId”: 14,        “homesteadBlock”: 0,        “eip155Block”: 0,        “eip158Block”: 0    },  “alloc”      : {},  “coinbase”   : “0x0000000000000000000000000000000000000000”,  “difficulty” : “0x05000”,  “extraData”  : “”,  “gasLimit”   : “0x2fefd8”,  “nonce”      : “0x0000000000000042”,  “mixhash”    : “0x0000000000000000000000000000000000000000000000000000000000000000”,  “parentHash” : “0x0000000000000000000000000000000000000000000000000000000000000000”,  • Read More »


以太坊星火节点 CentOS 接入

转自:https://ethfans.org/wikis/%E6%98%9F%E7%81%AB%E8%8A%82%E7%82%B9%E8%AE%A1%E5%88%92-CentOS-%E6%8E%A5%E5%85%A5%E6%96%87%E6%A1%A3 https://ethfans.org/wikis/%E6%98%9F%E7%81%AB%E8%8A%82%E7%82%B9%E8%AE%A1%E5%88%92-Ubuntu-%E6%8E%A5%E5%85%A5%E6%96%87%E6%A1%A3   CentOS 的安装和部署流程跟 Ubuntu 的主要区别只有四点,其他部分均可以直接参考 Ubuntu 接入文档,所以这里只对这四点作出解释。 创建 deploy 用户 安装系统依赖库 安装 geth 安装 NodeJS 创建 deploy 用户 # 首次以 root 用户登陆后,先安装 sudo yum -y install sudo   # 创建 deploy 用户 adduser deploy   # 设置 deploy 用户密码 passwd deploy   # 给 deploy 用户添加 sudo 权限 echo “deploy    ALL=(ALL) ALL” >> • Read More »


Mining Monero On Centos

建站的时候租用了一台服务器,centos的操作系统。上面只放了两个网站, CPU使用率基本为零,偶尔操作的时候也只有40%,闲置是极大的浪费。资料说门罗币(monero)可以用cpu挖,那我也挖门罗币吧。 首先要有钱包地址,本地钱包或者在线钱包,我选择了后者,所以前者就不多说了。在线平台有很多,网友说这家还不错https://mymonero.com/,https://hitbtc.com/,注册账号之后在account里找到钱包地址,下面会用到。 接下来要在服务器上安装挖矿工具,以下命令复制粘贴。安装运行需要的程序后,从fireice-uk获取源码并编译安装,此处可以修改捐赠比例,默认是2%。 sudo yum -y install centos-release-scl epel-release sudo yum -y install cmake3 devtoolset-7-gcc* hwloc-devel libmicrohttpd-devel openssl-devel make sudo scl enable devtoolset-7 bash git clone https://github.com/fireice-uk/xmr-stak.git mkdir xmr-stak/build cd xmr-stak/build cmake3 -DCMAKE_LINK_STATIC=ON -DXMR-STAK_COMPILE=generic -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF .. make install 然而总是在42%时出错,在网上找到了这个办法。清除后重新编译。 mkdir xmr-stak/build cd xmr-stak/build export CFLAGS=”-O2 -march=native -msse3 -fomit-frame-pointer -pipe” export CHOST=”x86_64-pc-linux-gnu” export CXXFLAGS=”${CFLAGS}” • Read More »


Multi-sites and 404 of Permalinks issue

Initially, I was going to write something about using Modelica for simulations of HVAC systems. But I have been assigned to other tasks. So, I just share some experience about connecting one IP with multi-domains here. My server has been running a website already when the server is set for running multi-sites, the original files • Read More »


SetUpDesktopOnSever

SetUpDesktopOnSever Recently, I tried to download recovery image for my Surface Pro 3 from the official website.  The established downloading link lost connection after a few minutes and the download speed was within 10 kb/s. Since the server rent from Aliyun is overseas, I considered to download it from the server. There are two options • Read More »


ErrConnectingDatabase

After upgrading to Version 4.9. I got an error of Error establishing a database connection. The possible cause of ‘Error establishing a database connection’ is the problems in MySQL, check the username and password in wp-config.php. But the causes may vary. Firstly, open ‘wp-config.php’ and set ‘define(‘WP_DEBUG’, ‘true’)’; Then, go to the website to see • Read More »