sed

sed 是一种流编辑器,用于对输入流(文件或管道)进行基本的文本转换。它是 Unix/Linux 系统下的一个非常强大的文本处理工具。以下是 sed 的一些常见用法:

  • 替换文本
  sed 's/旧字符串/新字符串/' 文件名

这会将文件中的第一个匹配到的“旧字符串”替换为“新字符串”。

  • 替换所有匹配项
  sed 's/旧字符串/新字符串/g' 文件名

这会将文件中所有匹配到的“旧字符串”替换为“新字符串”。

  • 在特定行替换
  sed '2s/旧字符串/新字符串/' 文件名

这只会替换第 2 行中的第一个匹配项。

  • 删除行
  sed '2d' 文件名

这会删除第 2 行。

  • 打印特定行
  sed -n '2p' 文件名

这只会打印第 2 行。

  • 保存更改到文件
  sed -i 's/旧字符串/新字符串/g' 文件名

这会直接修改原文件内容。

如果你有具体的 sed 使用场景或问题,请提供更多信息,我可以给出更详细的帮助。

PHP安全的获取ip

    public static function getIpX(): ?string {
        [$ip] = self::getIp();
        return $ip;
    }

    public static function getIp(): array {
        $ip0 = $ip = $_SERVER['REMOTE_ADDR'] ?? null;
        if (in_array($ip, [
            '10.29.185.7', '127.0.0.1', '172.17.0.1', '172.31.242.237', # 可信IP列表
        ])) {
            $ip1 = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? null;
            if ($ip1) {
                $ip0 = $ip1;
                $ip = explode(',', $ip1)[0];
            }
        }
        if (!$ip) {
            $ip = $_SERVER['REMOTE_ADDR'] ?? null;
        }
        return [$ip, $ip0];
    }

Linux swap使用率为0

Linux 中 Swap 交换分区设置教程,以及 Swap 大小与内存的关系 – 知乎

系统配置:Linux有一个swappiness参数,决定了系统使用swap的频率。默认值通常为60,值越低,越不容易使用swap。可以通过以下命令查看当前值:

cat /proc/sys/vm/swappiness

如果你希望系统更倾向于使用swap,可以将其设置为一个更高的值,例如:

sudo sysctl vm.swappiness=80
————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/sunyuhua_keyboard/article/details/14248714

nginx restart failed:nginx: [alert] OPENSSL_init_ssl() failed (SSL: error:12800067:DSO support routines::could not load the shared library:filename(/snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so): /snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so: cannot open shared object file: No such file or directory error:12800067:DSO support routines::could not load the shared library error:07880025:common libcrypto routines::reason(37):name=fips error:0700006D:configuration file routines::module initialization error:module=providers, value=provider_sect retcode=-1 ) 解决办法

nginx restart failed:
nginx: [alert] OPENSSL_init_ssl() failed (SSL: error:12800067:DSO support routines::could not load the shared library:filename(/snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so): /snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so: cannot open shared object file: No such file or directory error:12800067:DSO support routines::could not load the shared library error:07880025:common libcrypto routines::reason(37):name=fips error:0700006D:configuration file routines::module initialization error:module=providers, value=provider_sect retcode=-1 )

解决办法:

nginx restart failed:
nginx: [alert] OPENSSL_init_ssl() failed (SSL: error:12800067:DSO support routines::could not load the shared library:filename(/snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so): /snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so: cannot open shared object file: No such file or directory error:12800067:DSO support routines::could not load the shared library error:07880025:common libcrypto routines::reason(37):name=fips error:0700006D:configuration file routines::module initialization error:module=providers, value=provider_sect retcode=-1      )

Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
[root@ooops ~]# find / -name fips.so
/usr/lib64/ossl-modules/fips.so
[root@ooops ~]# mount --bind /usr/lib64/ossl-modules/ /snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/

4325注意替换为你的id

HTML中的0宽度空格

HTML中的0宽度空格是一个不可见的字符,它用于在HTML中创建小的间隔或强制文本或元素在同一行内显示。

要在HTML中插入0宽度空格,你可以使用字符实体​。这是一个不断行的空格(zero-width space,ZWSP),它不会产生任何可见的间隔,但会占用空间。