GV和环聊该使用哪个?

Google Voice 有两个app,一个是google voice,一个是hangouts, 这两个app相比较来说肯定是hangouts好用很多

但是这个只是在苹果手机上而言, 在苹果手机上你可以使用hangouts来接发短信和拨收电话,确实很方便

但是在安卓手机上,hangouts 只能接受和发短信,无法拨打电话,需要一个叫做环聊拨号器的app,也是google开发的,但是

环聊拨号器这个app 早在2015年就停止更新了

因此在苹果手机上使用hangouts,在安卓手机上使用GV apps 是最好的选择

Centos 7 通过openresty repo 安装openresty 解析

通过openresty repo 安装的文档可以看这里:

https://openresty.org/en/linux-packages.html

目前用yum安装的过程中,安装的组件版本如下:

Installing:
openresty x86_64 1.17.8.2-1.el7 openresty 1.1 M
Installing for dependencies:
openresty-openssl111 x86_64 1.1.1g-3.el7 openresty 1.6 M
openresty-pcre x86_64 8.44-1.el7 openresty 164 k
openresty-zlib x86_64 1.2.11-3.el7.centos openresty 54 k

安装openresty resty的话,版本如下:

openresty-resty-1.17.8.2-1.el7.noarch

openresty 的bin 安装路径为:

/usr/bin/openresty

查看一下使用repo安装的openresty的详细配置:

[root@centos ~]# openresty -V
nginx version: openresty/1.17.8.2
built by gcc 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)
built with OpenSSL 1.1.1g 21 Apr 2020
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.17 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../ngx_stream_lua-0.0.8 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' --with-cc='ccache gcc -fdiagnostics-color=always' --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat --with-stream --with-stream_ssl_preread_module --with-http_ssl_module

可以看到基本上配置的非常全面的,非常好了

看一下本机的openssl version:

[root@centos ~]# openssl version
OpenSSL 1.0.2k-fips 26 Jan 2017

查看一下openresty service配置:

[Unit]
Description=The OpenResty Application Platform
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/usr/local/openresty/nginx/logs/nginx.pid
ExecStartPre=/usr/local/openresty/nginx/sbin/nginx -t
ExecStart=/usr/local/openresty/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Openresty 默认的nginx conf 位于:

/usr/local/openresty/nginx/conf/nginx.conf

配置为:

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}

Zabbix Agent的安装和使用

最近需要在服务器集群上监控服务器们的CPU和RAM的使用情况,zabbix 主服务器在US, agent 安装在监控的服务器上.

总的来说其实很简单,主要就是两个步骤:

  1. 安装zabbix agent 组件并且设置好conf文件
  2. 防火墙打开10050端口或者直接whitelist zabbix主服务器的IP

 

下面是详细的步骤:

1 安装组件

4.4 for centos and debian

Centos 7: 

rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm

yum install zabbix-agent

Centos 8:

rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm

yum install zabbix-agent

Debian 9:

# wget https://repo.zabbix.com/zabbix/4.4/debian/pool/main/z/zabbix-release/zabbix-release_4.4-1+stretch_all.deb
# dpkg -i zabbix-release_4.4-1+stretch_all.deb
# apt update

#apt install zabbix-agent

Debian 10:

# wget https://repo.zabbix.com/zabbix/4.4/debian/pool/main/z/zabbix-release/zabbix-release_4.4-1+buster_all.deb
# dpkg -i zabbix-release_4.4-1+buster_all.deb
# apt update

#apt install zabbix-agent

zabbix 5.0 LTS for debian 9

# wget https://repo.zabbix.com/zabbix/5.0/debian/pool/main/z/zabbix-release/zabbix-release_5.0-1+stretch_all.deb
# dpkg -i zabbix-release_5.0-1+stretch_all.deb
# apt update

# apt install zabbix-agent

zabbix 5.0 LTS for centos 7

# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

# yum install zabbix-agent

2 修改配置文件

无论centos 还是debian,都是在/etc/zabbix/zabbix-agentd.conf

agent 可以以两种模式运行: passive 和 active,我们一般使用passive 模式就可以,也最简单,只需要修改

Passive checks related下面的Server IP就可以

默认的是Server=127.0.0.1, 把127.0.0.1改成你的zabbix 主服务器的IP就可以了

3 防火墙打开10050 端口或者直接whitelist 你的zabbix主服务器的IP就可以了

Priceonomics:美国买房最实惠和最不实惠的城市排行榜

一直有在美国买房的打算,刚好看到这个统计,就转过来

美国最实惠的地方是俄亥俄州的扬斯敦,紧随其后的是密西西比州的杰克逊。在这两个地方,家庭收入中位数都高于一套房子的购买价格。最实惠城市排行榜上的每个城市都位于南部或中西部。在美国的609个地方中只有50个的负担能力得分超过36%。美国的绝大多数地方的房价都很难负担得起。

接下来,我们来看看美国最负担不起的住房市场。以下图表显示了地方收入对购房影响不大的地方:

美国最负担不起的地方是加利福尼亚州的纽波特海滩,紧随其后的是加利福尼亚州的圣莫尼卡。在这些地方,典型的年收入仅占房屋购买价格的5.3%。事实上,在最负担不起的城市排行榜25名中有24个位于加利福尼亚州。

对于购房者来说,美国最实惠的州是密西西比州,紧随其后的是俄亥俄州和俄克拉何马州。最负担得起的12个州中的每一个都在南部和中西部。最负担不起的州是夏威夷、华盛顿特区和加利福尼亚州。最负担不起的地方都在这个国家的西部和东部。

在美国最大的50个市场中,密歇根州的底特律是最实惠的,因为一个家庭的工资与房屋购买价格的比率为83.4%。排名前5位的城市都在南部或中西部。旧金山是美国最负担不起的大城市,紧随其后的是洛杉矶和奥克兰。排名前十的城市中有6个位于加利福尼亚州,纽约、火奴鲁鲁、波士顿和迈阿密也跻身最负担不起的主要城市之列。

/bin/bash^M: bad interpreter: No such file or directory

好久没有写bash脚本了,这两天在写一个网站受到攻击自动开始CF五秒盾的bash脚本,利用CF的API可以很轻松的写完这个脚本,可是测试的时候出问题了,提示

/bin/bash^M: bad interpreter: No such file or directory

以前我遇到过好多次这个问题,依稀记得是windows 和unix的编码不一样,换行符的标志也不一样. windows 是CR LF表示一行结尾,而unix用LF表示一行的结尾。

知道了问题的原因,解决起来就好说多了.

  1. 直接将windows下的编辑器的脚本编码转换,转换为unix格式,然后再去unix下执行. 对于ultraedit来说,路径是 File–>Conversions–>DOS->UNIX;对于notepad++来说,路径是setting-> Preferences-> New Document -> Unix, 或者在正在编辑的文件上,点击Edit -> EOL Conversion -> Unix

2) 在unix服务器上,直接运行dos2unix命令,将bash文件转化为unix下的文件

3) vi 命令解决. 首先可以用”vi -b cloudflare.sh”命令,来查看这个bash文件里面隐藏的字符,然后用”vi cloudflare.sh”打开,按下ESC键进入命令行模式,输入下面的命令:

:set ff=unix

:wq

将文本格式设置为unix格式