Linux系统用bash制作录制回放功能脚本

今天看到一个有趣的脚本,放在这里分享一下

转子:https://www.jb51.net/article/130973.htm


#!/bin/bash
# Filename:Record.sh

read -p "Please input the sesson filename you want to creat: " filename;

sesfile="$filename.session"
logfile="$filename.timing.log"

if [ -e $sesfile ];then
  echo "$sesfile is Exsit,Creat session file fault!";
  read -p "If you want to reload the file? [Y/N]: " flag;
  if [ "$flag" = "Y" ];then
    rm $sesfile $logfile;
    script -t 2> $logfile -a $sesfile;
  else
    echo "Nothing to do!";
  fi

else
  script -t 2> $logfile -a $sesfile;
fi

#!/bin/bash
# Filename:Replay.sh

read -p "Please input the session filename: " filename
logfile="$filename.timing.log"
sesfile="$filename.session"
if [ -e $sesfile ]; then
  scriptreplay $logfile $sesfile
  echo
else
  echo "$filename is NOT Exsit!"
fi

再补一个TermRecord方法,TermRecord是python编写的脚本,所以,linux环境里必须有python及web环境

pip install TermRecord
TermRecord -o /path/filename_html
停止录制,键入 exit

在web浏览器中打开filename_html就可以看到输出结果
做了个例子,大家可以看看
https://techlife.com.cn/190812.html

关于python3中文编码的问题的解决及一个方便查询whois的小程序

今天写了个查whois信息的小程序,在python3命令行测试,是正常的,但一用到print命令,就输出乱码,网上找了一些文章,还是觉得这篇写的最准确,共享出来

https://www.cnblogs.com/gjq168/p/9262559.html

说说这个程序,用到的是python-whois 0.7.1模块,之前查询whois信息,总是需要去网站输入,比较麻烦,现在用python3,方便多了,代码公开一下,名字是testwhois.py


#!/usr/bin/python3
# -*- coding: utf-8 -*-

import whois
import sys

w = whois.whois(sys.argv[1])
data = w.text.encode("utf-8").decode("utf-8")
print(data)

使用方法:
./testwhois.py www.163.com

RHEL8 安装 python3.6.9(191023更改,加入Python3.8安装)

Python 3.6.9 – July 2, 2019 新放出的安全补丁版本,正好整了一台RHEL8,装上测试一下

首先因为pip3安装模块需要使用SSL,否则会报SSL连接错误,所以需要先安装openssl-devel


yum -y install openssl-devel

然后安装 Python 3.6.9


3.6.9版本
./configure --prefix=/usr/local/python3 --enable-optimizations --with-ssl
make;make install

3.8版本
./configure --prefix=/usr/local/python3 --enable-shared --enable-optimizations --with-libs='/usr/lib64/libcrypto.so /usr/lib64/libssl.so' --with-ssl-default-suites=openssl  --disable-ipv6

cd /usr/bin/
ln -s /usr/local/python3/bin/python3
ln -s /usr/local/python3/bin/pip3

Looking in links: /tmp/tmp6u244lwp
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-18.1 setuptools-40.6.2

结束安装时会自动安装setuptools 以及 pip

附(引用,原文在https://blog.csdn.net/iodjSVf8U1J7KYc/article/details/85241988 ):

从 RHEL 8 Beta 开始不再强调“系统 Python”,不再默认一个 Python 版本。他们使用模块化的 Application Streams 设计,结合 Python 可多版本同时安装的特点,将为用户提供多个版本 Python 的选项,并且可以从标准存储库轻松安装到标准位置,用户可以选择他们想要在任何给定用户空间中运行的 Python 版本。

Application Streams 是在 RHEL 8 中引入的一类存储库,它提供用户可能希望在给定用户空间中运行的所有应用程序,它是在物理存储库中创建的多个虚拟存储库。

这种变化之后,用户想要使用 Python,需要直接指定 Python3 或者 Python2,而不是直接 Python。同时 yum install python 将返回 404,因为它同样需要指定安装版本。建议使用 yum install @python36 或 yum install @python27 安装推荐软件包,而如果只需要 Python 二进制文件,则可以使用 yum install python3 或 yum install python2。此外,pip 等工具也有变化,比如 Python3 将安装在 pip3 路径下,而不是没有版本指定的 pip 路径。

Red Hat 解释,除了提升用户体验,这种方案还让方便了系统维护人员,因为不会被锁定在系统中老版本的 Python 上,那么他们可以自由地利用新版本的语言功能与性能改进等优势。

Centos中dig命令的使用

一、安装

yum install bind-utils -y

二、使用

(1)指定某DNS查询一个域名。以www.people.cn为例。

dig www.people.cn @dns address

(2)查询A记录

dig www.people.cn A +noall +answer @dns address

(3)查询权威DNS

dig www.people.cn NS +noall +answer @dns address

后面有其他继续增加

Pureftpd+Mysql中的status参数不管用的解决方法

现象:Pureftpd+Mysql中的status参数设置为0表示账户不启用,1表示正常使用,重新安装了Pureftpd+Mysql后这个参数不起作用了

解决:pureftpd-mysql.conf 中有关于 Pureftpd 调用 Mysql 中各参数的简单例子,修改这里即可,下面是我的文件中的,大家按照自己的数据库列名字修改即可,把默认的注释掉,默认的是没有status以及ipaccess参数的

#ADD
MYSQLGetPW SELECT Password FROM users WHERE USER="\L" AND STATUS="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetUID SELECT Uid FROM users WHERE USER="\L" AND STATUS="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetGID SELECT Gid FROM users WHERE USER="\L" AND STATUS="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetDir SELECT Dir FROM users WHERE USER="\L" AND STATUS="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE USER="\L" AND STATUS="1" AND (ipaccess = "*" OR ipaccess LIKE"\R")
MySQLGetQTASZ SELECT QuotaSize FROM users WHERE USER="\L" AND STATUS="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetRatioUL SELECT ULRatio FROM users WHERE USER="\L" AND STATUS="1" AND (ipaccess ="*" OR ipaccess LIKE "\R")
MySQLGetRatioDL SELECT DLRatio FROM users WHERE USER="\L" AND STATUS="1" AND (ipaccess ="*" OR ipaccess LIKE "\R")
MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE USER="\L" AND STATUS="1" AND (ipaccess ="*" OR ipaccess LIKE "\R")
MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE USER="\L" AND STATUS="1" AND (ipaccess ="*" OR ipaccess LIKE "\R")

How do I ensure excel file with wide columns does not get truncated in Confluence File Previews(转)

https://confluence.atlassian.com/confkb/how-do-i-ensure-excel-file-with-wide-columns-does-not-get-truncated-in-confluence-file-previews-829068467.html

Purpose
This article contain instructions on how to change the display of excel files in confluence File Preview / light box, mainly because by default, confluence file preview will truncate excel files with wide columns/ excel files with huge number of columns.

For example, below is a sample excel file with a huge number of columns:

Upon uploading to confluence, the columns will be truncated and will be displayed as below:

继续阅读How do I ensure excel file with wide columns does not get truncated in Confluence File Previews(转)