ipython崩溃异常退出解决办法

ipython

  • ipython是一个非常实用的交互软件, 能帮助python coder快速实时的看到运行结果,但随着版本更新,不可避免出现一些意想不到的情况,比如ipython3.6.8之后的版本安装总会遇到'''AttributeError: 'TypeError' object has no attribute 'tb_frame'''这样的报错
  • 总结解决办法, 如果有其它项目或工程依赖jedi,请谨慎删除
    '''

pip3 uninstall jedi --yes
'''

sed脚本技巧-在匹配内容后追加

SED编辑器修改文本,在匹配内容后追加

  • 最近使用宝塔建站,网址比较多的时候修改起来比较费时间,搞个shell脚本批量处理,实现功能 access_log /path/abc/file.log; 指定日志格式
sed -i 's#access_log.*\.log#& ngx_log#g'  /path/abc/file.log
  • 知识点: &用来表示模式匹配(正则表达式匹配)的范围

Python离线安装模块

pip离线安装

pip 下载模块相关文件

pip3  download   bs4 Path asyncio argparse

离线安装

pip3 install --no-index --find-links='path/'  bs4 Path asyncio argparse

宝塔环境下acme脚本使用

宝塔环境命令行更新HTTPS证书

  • acme_v2.py

    • /www/server/panel/class/acme_v2.py文件解读略
    • 使用方法详见if __name__ == '__main__'中语句
    • 使用示例
    python /www/server/panel/class/acme_v2.py --domain 域名1,域名2 --type http --path 网址根路径

cert-bot更新多域名证书

获取cert-bot

wget https://dl.eff.org/certbot-auto --no-check-certificate
chmod +x ./certbot-auto

例子

./certbot-auto certonly --email name@3-seo.com --agree-tos --no-eff-email --webroot -w /home/wwwroot/a.com -d a.com -d b.com -d c.com

参数

–certonly 获取或更新证书,但是不安装到本机。这个参数默认是 run,即获取或更新证书并安装。另一个值是 renew,即更新证书。
–nginx 使用 nginx 插件
–agree-tos 同意 ACME 服务器的订阅协议
–redirect: Force HTTPS by 301 redirect.
–hsts:将 Strict-Transport-Security 标头添加到每个 HTTP 响应中。强制浏览器始终对域使用 TLS。防御 SSL / TLS 剥离。
–staple-ocsp:启用 OCSP 装订。将有效的 OCSP 响应装订到服务器在 TLS 期间提供的证书。
–preferred-challenges dns 以 DNS Plugins 的方式进行验证
–manual 采用手动交互式的方式验证
–email 接收有关账户的重要通知的邮箱地址,非必要,建议最好带上
-d yourdomain.com -d *.yourdomain.com 指定要验证的域名。注意,不带 www 的一级域名 yourdomain.com,和通配符二级域名 *.yourdomain.com 都要写,如果只写 *.yourdomain.com 生成出来的证书是无法识别 yourdomain.com 的