分类 默认分类 下的文章

方法一:read指令
该命令是在shell提示符下获取用户输入的最简单,使用最广泛的方法read。演示其用法的最佳方法是一个简单的演示:

#! /bin/bash

while true; do
    read -p "Do you wish to install this program? [Y/N]" yn
    echo You input is: $yn;
    case $yn in
        [Yy]* ) echo make install; break;;
        [Nn]* ) exit;;
        * ) echo "Please answer yes or no.";;
    esac
done

方法二:select指令
另一种方法是Bash的命令。这是使用的相同示例:select

#! /bin/bash

echo "Do you wish to install this program? Please select a number:"
select yn in "Yes" "No"; do
    echo You input is: $yn;
    case $yn in
        Yes ) echo make install; break;;
        No ) exit;;
    * ) echo "Please answer yes or no.";;
    esac
done

执行命令结果:

$ ./test_select.sh 
Do you wish to install this program? Please select a number:
1) Yes
2) No
#? 2
You input is: No
$ ./test_select.sh 
Do you wish to install this program? Please select a number:
1) Yes
2) No
#? 1
You input is: Yes
make install

MySQL主从复制状态及数据一致性监测工具 percona-toolkit:
详情简介使用文章:
https://www.cnblogs.com/kevingrace/p/6261091.html

percona-toolkit工具介绍 percona-toolkit工具中最主要的三个组件分别是:

  • pt-table-checksum 负责监测mysql主从数据一致性
  • pt-table-sync 负责当主从数据不一致时修复数据,让它们保存数据的一致性
  • pt-heartbeat 负责监控mysql主从同步延迟

另外两个工具介绍:
配置生成工具https://sc.toolnb.com/tools/mysqlslave.html
主从复制错误修复工具:https://github.com/hcymysql/pt-slave-repair

清理数据库中的统计信息和检测日志
注意:该操作会清除所有日志信息,且不可恢复

docker exec safeline-mgt cleanlogs

雷池占用磁盘,如何清理空间(清理统计数据)
大流量情况下,统计数据比较占用存储空间,如果发现luigi文件空间占用过大

有些环境需要使用docker-compose的命令,自行替换即可:

  • 停止雷池,在安装的safeline目录下执行命令:docker compose down
  • 直接删除 safeline/resources/luigi 文件夹
  • 启动雷池,在安装的safeline目录下执行命令:docker compose up -d
  • 删除文件会丢失统计数据,注意数据备份

其它常见问题及故障排查处理请参考官方文档:
https://docs.waf-ce.chaitin.cn/zh/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E6%8E%92%E6%9F%A5

iopaint是一个开源的AI去水印的工具,可以本地部署

Install pytorch
If you want to run model on GPU, it is necessary to install the GPU version of PyTorch. Otherwise, you can skip this step.

For NVIDIA GPU users

pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118

For AMD GPU users, only works on linux, as pytorch is not yet supported on Windows with ROCm.

pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/rocm5.6

Install IOPaint
pip3 install iopaint

**Start IOPaint server**

iopaint start --model=lama --device=cpu --port=8080

IOPaint is now running at http://localhost:8080(opens in a new tab), you can open it in your browser to start using it.

You can see all command line arguments using iopaint start --help, and you can see more models and features in the models page.


**解决安装Failed building wheel for pillow**
解决error: command ‘x86_64-linux-gnu-gcc‘ failed with exit status 1

apt-get install libjpeg-dev zlib1g-dev

查看自己python的版本,然后下载自己版本Python的devel,比如python3.7.7就是

sudo apt-get install python3.7-dev

sudo apt-get install build-essential python3-dev libssl-dev libffi-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev