<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[胡振伟博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/huzhenwei</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; huzhenwei]]></copyright><item><title><![CDATA[使用python wasmtime调用rust生成的wasm库]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/128517154</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/128517154</guid><author>huzhenwei</author><pubDate>Mon, 02 Jan 2023 00:13:22 +0800</pubDate><description><![CDATA[本文介绍了使用python wasmtime来访问rust库的便捷方法，步骤极其简练，可以在生产环境中使用。]]></description><category></category></item><item><title><![CDATA[gitlab容器prometheus和sidekiq日志增长过快的一种解决方案]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/128321312</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/128321312</guid><author>huzhenwei</author><pubDate>Wed, 14 Dec 2022 20:12:15 +0800</pubDate><description><![CDATA[最近发现一台服务器docker容器所占磁盘空间巨大，排查发现是git容器日志增长过快，约每天增长数十G。查看日志内容，发现其中prometheus和sidekiq极多，这些都是我们目前没有用到的组件。gitlab管理界面上将其关闭时出错，于是通过修改配置文件解决。]]></description><category></category></item><item><title><![CDATA[使用腾讯企业邮箱发送邮件的Python脚本，支持发送给多人]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/128293474</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/128293474</guid><author>huzhenwei</author><pubDate>Mon, 12 Dec 2022 21:28:09 +0800</pubDate><description><![CDATA[【代码】使用腾讯企业邮箱发送邮件的Python脚本，支持发送给多人。使用方式极其简洁。示例用法详见代码底部。]]></description><category></category></item><item><title><![CDATA[使用Python生成四种字符组合的复杂随机密码]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/128244942</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/128244942</guid><author>huzhenwei</author><pubDate>Thu, 08 Dec 2022 22:41:07 +0800</pubDate><description><![CDATA[使用Python的random和string库生成大写字母、小写字母、数字、特殊字符（14个）这四种字符组合的复杂度较高的随机密码。精选特殊字符，兼容性好。:P]]></description><category></category></item><item><title><![CDATA[CentOS8上部署NFS服务端和客户端]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/128139922</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/128139922</guid><author>huzhenwei</author><pubDate>Thu, 01 Dec 2022 22:33:17 +0800</pubDate><description><![CDATA[配置NFS共享存储，多客户端可写]]></description><category></category></item><item><title><![CDATA[容器化技术最佳实践2--制作自己的Docker镜像]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/128139793</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/128139793</guid><author>huzhenwei</author><pubDate>Thu, 01 Dec 2022 22:10:21 +0800</pubDate><description><![CDATA[【代码】容器化技术最佳实践2--制作自己的Docker镜像。]]></description><category></category></item><item><title><![CDATA[容器化技术最佳实践1--容器化技术简介与Docker入门]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/128132327</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/128132327</guid><author>huzhenwei</author><pubDate>Thu, 01 Dec 2022 15:12:57 +0800</pubDate><description><![CDATA[容器化技术是大势所趋，使用rootless（非特权用户）来运行容器是非常好的实践方式。]]></description><category></category></item><item><title><![CDATA[使用mosquitto处理MQTT消息（支持离线消息）]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/126641727</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/126641727</guid><author>huzhenwei</author><pubDate>Thu, 01 Sep 2022 15:49:58 +0800</pubDate><description><![CDATA[Linux上使用mosquitto发布和订阅MQTT消息，支持离线消息、消息过期机制。]]></description><category></category></item><item><title><![CDATA[MacOS Apple M1上安装tensorflow2使用其原生GPU]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/121931635</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/121931635</guid><author>huzhenwei</author><pubDate>Wed, 15 Dec 2021 16:42:30 +0800</pubDate><description><![CDATA[安装Mambaforge
首选推荐安装Mambaforge, 也可以安装miniforge3。
项目链接：https://github.com/conda-forge/miniforge/
创建conda虚拟环境
conda create -n tf270 -c apple tensorflow-deps
conda activate tf270
pip install tensorflow-macos tensorflow-metal
测试安装是否成功
import tensorflow as tf
pr]]></description><category></category></item><item><title><![CDATA[pyaduio使用指定设备录制或播放音频]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/121909997</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/121909997</guid><author>huzhenwei</author><pubDate>Mon, 13 Dec 2021 18:18:35 +0800</pubDate><description><![CDATA[获取设备列表
import pyaudio
p = pyaudio.PyAudio()
#print(p)
device_index = 0

for i in range(p.get_device_count()):
    device_info = p.get_device_info_by_index(i)
    if device_info.get('name', '').find('i2s') != -1:
        print(device_info)
        device_in]]></description><category></category></item><item><title><![CDATA[在Ubuntu 20上安装bazel]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/121892132</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/121892132</guid><author>huzhenwei</author><pubDate>Sun, 12 Dec 2021 19:36:20 +0800</pubDate><description><![CDATA[Ubuntu 20官方仓库没有bazel这个编译工具，可以通过如下方式安装：
设置bazel的镜像源
sudo apt install curl gnupg
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor &gt; bazel.gpg
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
echo “deb [arch=amd64] https://storage.googleapis.c]]></description><category></category></item><item><title><![CDATA[在树莓派raspberry 3B上安装tensorflow python运行时环境tflite-runtime]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/121890704</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/121890704</guid><author>huzhenwei</author><pubDate>Sun, 12 Dec 2021 17:47:28 +0800</pubDate><description><![CDATA[tflite-runtime python库网址
https://google-coral.github.io/py-repo/tflite-runtime/
下载安装tflite-runtime
wget https://github.com/google-coral/pycoral/releases/download/v2.0.0/tflite_runtime-2.5.0.post1-cp39-cp39-linux_armv7l.whl#sha256=44ade5fa9d429ff7fcd439b596]]></description><category></category></item><item><title><![CDATA[批量拷贝公钥到新上架机器的方式]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/120787735</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/120787735</guid><author>huzhenwei</author><pubDate>Fri, 15 Oct 2021 17:41:33 +0800</pubDate><description><![CDATA[批量拷贝公钥到新上架机器的方式
新服务器上架后，需要配置公钥、修改密码，可用ansible-playbook批量修改：
# 安装依赖包
# sudo apt install sshpass

# 拷贝root公钥到远程主机root用户，远程机器上的huzhenwei用户需要在sudo组里
sudo -H ansible-playbook /etc/ansible/playbooks/user-root.yml -u huzhenwei -k --become-user=root --become-metho]]></description><category></category></item><item><title><![CDATA[使用ansible修改远程主机用户密码]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/120787662</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/120787662</guid><author>huzhenwei</author><pubDate>Fri, 15 Oct 2021 17:30:59 +0800</pubDate><description><![CDATA[使用ansible修改远程主机用户密码
创建新的密码
在自己的电脑上运行：openssl passwd -6 "新的密码"
将打印出来的字符串贴到playbook中
- hosts: "{{ group }}"
  tasks:
    - name: "Manage group huzhenwei"
      group:
        name: huzhenwei
        state: present

    - name: "Manage user huzhenwei"
      u]]></description><category></category></item><item><title><![CDATA[centos上安装trac任务管理系统]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/7181690</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/7181690</guid><author>huzhenwei</author><pubDate>Fri, 15 Oct 2021 17:26:14 +0800</pubDate><description><![CDATA[目录
1. 引言... 4
1.1 文档用途... 4
1.2 阅读对象... 4
1.3 名词术语... 4
1.4 参考资料... 4
2. 系统介绍... 5
2.1 系统概述... 5
2.2 运行硬件环境... 5
2.2.1 应用服务器... 5]]></description><category></category></item><item><title><![CDATA[服务器安全管理规范]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/120787020</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/120787020</guid><author>huzhenwei</author><pubDate>Fri, 15 Oct 2021 17:06:07 +0800</pubDate><description><![CDATA[服务器安全管理规范
文章目录服务器安全管理规范Linux服务器安全管理规范系统安装堡垒机账号登录安全策略sudo策略审计策略应用策略防误操作策略
Linux服务器安全管理规范
系统安装

同类型同配置服务器数量超过20台时，应制作自动安装镜像来进行无人值守安装，避免人工安装导致的不一致
物理机操作系统使用最小化安装模式
如需图形界面，应安装在虚拟机上
磁盘分区采用主流模式（如CentOS7采用LVM卷管理系统、xfs文件系统）

磁盘条带化采取：软RIAD或硬RAID，LVM
文件系统选择主流：xfs，ex]]></description><category></category></item><item><title><![CDATA[git服务器Gitea安装及维护方式]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/120546759</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/120546759</guid><author>huzhenwei</author><pubDate>Wed, 29 Sep 2021 13:29:24 +0800</pubDate><description><![CDATA[Gitea安装及维护方式
文章目录Gitea安装及维护方式gitea介绍docker-compose方式安装设置编辑docker-compose.yml文件安装及启动服务查看状态初始化设置启动停止方式
gitea介绍
Gitea 是一个自己托管的Git服务程序。他和GitHub, Bitbucket or Gitlab等比较类似。详见：https://docs.gitea.io/zh-cn/
docker-compose方式安装设置
编辑docker-compose.yml文件
创建docker-compo]]></description><category></category></item><item><title><![CDATA[postgresql忘记密码了，重置postgres用户密码的方式（docker下）]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/120272523</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/120272523</guid><author>huzhenwei</author><pubDate>Mon, 13 Sep 2021 18:14:22 +0800</pubDate><description><![CDATA[# 进入docker容器
sudo docker exec -it my_postgres bash

# 运行psql命令
psql
# 或
psql -U postgres -d postgres -h 127.0.0.1 -p 5432

# 修改
ALTER USER postgres WITH PASSWORD 'NewPassword';
\q


]]></description><category></category></item><item><title><![CDATA[便捷设置swap交换分区的方式]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/119410632</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/119410632</guid><author>huzhenwei</author><pubDate>Thu, 05 Aug 2021 10:24:13 +0800</pubDate><description><![CDATA[便捷设置swap交换分区的方式
创建和使用交换分区
# 本示例创建了一个128G的交换分区，创建前先df -h看下是否有足够空间
sudo fallocate -l 128G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

将分区写入到/etc/fstab
使用sudo vim /etc/fstab编辑/etc/fstab，在文件末尾加入如下行：
# sudo vim /etc/fstab
/sw]]></description><category></category></item><item><title><![CDATA[设置MySQL表的只读授权和取消授权]]></title><link>https://blog.youkuaiyun.com/huzhenwei/article/details/118211334</link><guid>https://blog.youkuaiyun.com/huzhenwei/article/details/118211334</guid><author>huzhenwei</author><pubDate>Fri, 25 Jun 2021 10:35:25 +0800</pubDate><description><![CDATA[设置MySQL表的只读授权和取消授权
授权所有表的只读权限
GRANT SELECT ON spug.* to grafana@'%' IDENTIFIED BY '******';
FLUSH PRIVILEGES;

授权制定表的只读权限
GRANT SELECT ON spug.blocks to grafana@'%' IDENTIFIED BY '******';
GRANT SELECT ON spug.miner_lucky_val to grafana@'%';

撤销对表的授权
revok]]></description><category></category></item></channel></rss>