Harvey Mei

Good acts are better than good intentions.

7 月 152021
 

INSTALLED_APPS 默认包括了以下 Django 的自带应用:

django.contrib.admin -- 管理员站点, 你很快就会使用它。
django.contrib.auth -- 认证授权系统。
django.contrib.contenttypes -- 内容类型框架。
django.contrib.sessions -- 会话框架。
django.contrib.messages -- 消息框架。
django.contrib.staticfiles -- 管理静态文件的框架。

默认开启的某些应用需要至少一个数据表,所以,在使用他们之前需要在数据库中创建一些表。migrate 命令检查 INSTALLED_APPS 设置,为其中的每个应用创建需要的数据表。

$ python manage.py migrate

迁移模型

通过运行 makemigrations 命令,Django 会检测你对模型文件的修改(在这种情况下,你已经取得了新的),并且把修改的部分储存为一次 迁移。
迁移是 Django 对于模型定义(也就是你的数据库结构)的变化的储存形式。

(venv) harveymei@MacBookAir mysite % python manage.py makemigrations polls
Migrations for 'polls':
polls/migrations/0001_initial.py
- Create model Question
- Create model Choice
(venv) harveymei@MacBookAir mysite %

查看迁移命令将会执行的SQL语句

(venv) harveymei@MacBookAir mysite % python manage.py sqlmigrate polls 0001
BEGIN;
--
-- Create model Question
--
CREATE TABLE "polls_question" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "question_text" varchar(200) NOT NULL, "pub_date" datetime NOT NULL);
--
-- Create model Choice
--
CREATE TABLE "polls_choice" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL, "question_id" bigint NOT NULL REFERENCES "polls_question" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE INDEX "polls_choice_question_id_c5b4b260" ON "polls_choice" ("question_id");
COMMIT;
(venv) harveymei@MacBookAir mysite %

自动执行数据库迁移并同步管理你的数据库结构的命令 – 这个命令是 migrate

$ python manage.py migrate

(venv) harveymei@MacBookAir mysite % python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, polls, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying polls.0001_initial... OK
Applying sessions.0001_initial... OK
(venv) harveymei@MacBookAir mysite %

migrate 命令选中所有还没有执行过的迁移(Django 通过在数据库中创建一个特殊的表 django_migrations 来跟踪执行过哪些迁移)并应用在数据库上 – 也就是将你对模型的更改同步到数据库结构上。

迁移是非常强大的功能,它能让你在开发过程中持续的改变数据库结构而不需要重新删除和创建表 – 它专注于使数据库平滑升级而不会丢失数据。

改变模型需要这三步:

编辑 models.py 文件,改变模型。
运行 python manage.py makemigrations 为模型的改变生成迁移文件。
运行 python manage.py migrate 来应用数据库迁移。
7 月 152021
 

创建项目

$ django-admin startproject mysite

项目目录及文件说明

最外层的 mysite/ 根目录只是你项目的容器, 根目录名称对 Django 没有影响,你可以将它重命名为任何你喜欢的名称。
manage.py: 一个让你用各种方式管理 Django 项目的命令行工具。
里面一层的 mysite/ 目录包含你的项目,它是一个纯 Python 包。它的名字就是当你引用它内部任何东西时需要用到的 Python 包名。 (比如 mysite.urls).
mysite/__init__.py:一个空文件,告诉 Python 这个目录应该被认为是一个 Python 包。
mysite/settings.py:Django 项目的配置文件。
mysite/urls.py:Django 项目的 URL 声明,就像你网站的“目录”。
mysite/asgi.py:作为你的项目的运行在 ASGI 兼容的 Web 服务器上的入口。
mysite/wsgi.py:作为你的项目的运行在 WSGI 兼容的Web服务器上的入口。

启动用于开发的简易服务器

$ python manage.py runserver

更换端口

$ python manage.py runserver 8080
$ python manage.py runserver 0:8000

创建应用

$ python manage.py startapp polls

函数 include() 允许引用其它 URLconfs。每当 Django 遇到 include() 时,它会截断与此项匹配的 URL 的部分,并将剩余的字符串发送到 URLconf 以供进一步处理。
当包括其它 URL 模式时你应该总是使用 include() , admin.site.urls 是唯一例外。

函数 path() 具有四个参数,两个必须参数:route 和 view,两个可选参数:kwargs 和 name。现在,是时候来研究这些参数的含义了。

path() 参数: route
route 是一个匹配 URL 的准则(类似正则表达式)。当 Django 响应一个请求时,它会从 urlpatterns 的第一项开始,按顺序依次匹配列表中的项,直到找到匹配的项。

这些准则不会匹配 GET 和 POST 参数或域名。例如,URLconf 在处理请求 https://www.example.com/myapp/ 时,它会尝试匹配 myapp/ 。处理请求 https://www.example.com/myapp/?page=3 时,也只会尝试匹配 myapp/。

path() 参数: view
当 Django 找到了一个匹配的准则,就会调用这个特定的视图函数,并传入一个 HttpRequest 对象作为第一个参数,被“捕获”的参数以关键字参数的形式传入。稍后,我们会给出一个例子。

path() 参数: kwargs
任意个关键字参数可以作为一个字典传递给目标视图函数。本教程中不会使用这一特性。

path() 参数: name
为你的 URL 取名能使你在 Django 的任意地方唯一地引用它,尤其是在模板中。这个有用的特性允许你只改一个文件就能全局地修改某个 URL 模式。
7 月 092021
 

在GS1全球可追溯性标准中,定义了“可追溯性数据精度”这一概念。

附件图中描述了影响可追溯性资料精度的两个主要方面。
附件图中按照精度由低到高的方式排列了可追溯对象的识别层次。

精度最低的组合有助于提高透明度,这是可追溯性的基础。精度最高的组合有助于提高可追溯性,使组织能够在供应链中定位特定的可追溯对象。


其中应用标识符AI(21)“系列号”(国标)或序列号在实例(商品/贸易单元)级别实现了“一物一码”特性。

以下内容摘录翻译自GS1通用规范:

GS1应用标识符(21)表示GS1应用标识符数据字段包含序列号。序列号在实体的生命周期内分配给实体。与GTIN结合使用时,序列号可唯一标识单个项目。
品牌所有者和制造商有责任确保GTIN的序列号不重复。对于带有 GTIN的序列号的重复使用,需要考虑特定行业的限制。

序列号值为可变长度1-20位字符,字符集参照“GS1 AI encodable character set 82”和“GB/T 1988-1998”。涵盖IOT编码字符集。

与AI(21)具有相似特性的应用标识符包括AI(235)和AI(250)。

7 月 062021
 

思源宋体字重排序(大->小)

Heavy
Bold
SemiBold
Medium
Regular
Light
ExtraLight

https://fonts.adobe.com/fonts/source-han-serif-simplified-chinese

思源黑体字重排序(大->小)

Heavy
Bold
Medium
Regular
Normal
Light
ExtraLight

https://fonts.adobe.com/fonts/source-han-sans-simplified-chinese
6 月 042021
 

1,生成数据文件
说明:文件iot_code.txt中写入了一条36位字符长度的有效IOT编码数据。

[root@localhost ~]# echo "0CN01000000200000000000000000000gzAY" > iot_code.txt
[root@localhost ~]# cat iot_code.txt 
0CN01000000200000000000000000000gzAY
[root@localhost ~]#

2,生成私钥
说明:非对称加密由一组密钥对构成,分别是“私钥”及其对应的“公钥”。“私钥”信息属于机密信息,“公钥”信息可以公开分享给数据交换方。

[root@localhost ~]# openssl genrsa -out private.key
Generating RSA private key, 2048 bit long modulus (2 primes)
....+++++
..................................................+++++
e is 65537 (0x010001)
[root@localhost ~]# cat private.key 
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAltOrRKKvP8wKzq1BTlL2aKjpgM4mRHNWYWSexQBT69wMretq
9xGazVepAuPvZR2MtD3vX4kd3YkziXwJoHwj2DzeGlIlWYhO2v4QnfGZ4sx+9l06
86h7cQQJqzoNrIh8C9St95BMbu4ZlyFHoIHj72wlgLqNgdQLeFuMw7vrt0ZM3aBs
5gFc/7nOOSLD+AcU86fJEiJozxrV6hz8ylVDs+54Sd2ri/K6FejasjatOK9andtU
xV7h1PvnI2GwIcG8va3z3us74oyL/b6GCZmkdrdq44RXD9TVsd3POKFbb+aPAlkg
NINKU8tQJ2QwQLnc/PTsQJLNSE51xZcKefpAbwIDAQABAoIBAQCBGgOyx1Ic2Kmz
iSeqRGc45MSihVLKKrOYwAkK9aHf9MZBpI41l7Ma61r252ZF9go3SgB4lSSkOUmM
+EhBP6Fq+YbfnsrrnTpqRyiwGVqwgHx4owrP/7pR3bPtBc8ojNcpRU3352MVXOc4
rrrhz+zsRnS/gG+Z3ohG6I5QCK3WfJzu4TePHkLJoC8kmHuVGB/NTnHsh6liz1T8
IJXT2C2stCu5mVZOVaQr9AtyEVUCEaES/Lwi15/9QQfDzkXSH2Pi2sE7FlYnaVDN
ERXsnQ/73FaXcxgwNM6SiM77ZO17pfcuMaMGlrF5K4cFGe0zlR9YoCYuXf3CeFv1
5lmrxP4hAoGBAMVyZdfGhPXjXApMyZ0Iw97uFwpNsAP2SNNyndTGDNjhkG8HhZ1i
O4bsBCg+PYREraGCSWErHJ1z3uRvK37v3xDLIZYJ7+lXlWVvav9vNaR/nECvIMiF
x+QLo2IkoE55fb/p0MGhFjKkhqQBL3i/PTA9VFy7ySgt5hf0b4elgcZfAoGBAMOO
Auak7cQFJa5Ah1o2WZKgmv5qOlYDauXS8naMZ1Uw8UfnWNYL+t2QGy3eUpmiRDxc
Z6ytn3t/hklSF1gt4wcPyKxQ8CncNAEVR4FpQoFkRx+Lk5I/fw0iRa6T1Vio3lfj
AN5Hz1FJO3+4cJIT+YKkXfPKaHNO9e8kKKrm1x/xAoGBALb6yHUKbefuFzsYZHOa
TuNHZKTQ0EErudvzSV+JVxibGZ47q1DqW14zVbrxy1LLztlxg42ARZmJa1PpzrZp
mCDZDzwb43EtEK+bbN5h8qWK+YRciBYtHM0zF+v5I3L2VlpHVoZLQeYW4QwWaScO
m6cb/xWdldMdjjI+/ikIcdcjAoGAGVL/ryy2mcbs3UcAAD+/k8x2pfHNwivJISAT
RCTkkNS4uk4MZBPDFgQ+cM80tS6dVY/F4UfOumiGVGJsIYA3wUda/m2w3Erm9Sjz
TJ/7+9Onnj8uCids5Z+FlJkSbNvZh1ofV6nHAEjSirSw50ns6u0sOZEBu8UC9kgh
eBhSzZECgYEAjxZaDN1xm3zct23KcHc7G+x28OKyfanZNv4fV3oxSHDBRHgxJ4CO
Gb/ZVboAwlLTVdGA0fgBeyn9gRCLXzP8Z8Ex4wu5OiLjray9HxkCh8mikBk7PT/m
hsvhibHnX9V+/85Oo/ZS2MOyPcr12PTnHGtMSrNFbOihfvq0+8Z7bgY=
-----END RSA PRIVATE KEY-----
[root@localhost ~]#

3,使用私钥生成公钥
说明:“公钥”经由“私钥”信息经特定加密算法计算而来,每一个“私钥”与“公钥”的密钥对都是唯一组合。

[root@localhost ~]# openssl rsa -pubout -in private.key -out public.key
writing RSA key
[root@localhost ~]# cat public.key 
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAltOrRKKvP8wKzq1BTlL2
aKjpgM4mRHNWYWSexQBT69wMretq9xGazVepAuPvZR2MtD3vX4kd3YkziXwJoHwj
2DzeGlIlWYhO2v4QnfGZ4sx+9l0686h7cQQJqzoNrIh8C9St95BMbu4ZlyFHoIHj
72wlgLqNgdQLeFuMw7vrt0ZM3aBs5gFc/7nOOSLD+AcU86fJEiJozxrV6hz8ylVD
s+54Sd2ri/K6FejasjatOK9andtUxV7h1PvnI2GwIcG8va3z3us74oyL/b6GCZmk
drdq44RXD9TVsd3POKFbb+aPAlkgNINKU8tQJ2QwQLnc/PTsQJLNSE51xZcKefpA
bwIDAQAB
-----END PUBLIC KEY-----
[root@localhost ~]#

4,使用私钥对文件签名
说明:非对称加密算法中,“私钥”用于签名和解密,“公钥”用于加密和验证签名。此示例仅应用了签名和验证签名功能。签名的加密算法和摘要算法是可选的,例如从合规角度选择使用国密算法。

[root@localhost ~]# openssl dgst -md5 -out iot_code.txt.md5.sign \
> -sign private.key iot_code.txt 
[root@localhost ~]# ls
anaconda-ks.cfg iot_code.txt iot_code.txt.md5.sign private.key
[root@localhost ~]#

5,使用hexdump工具查看二进制签名文件(以十六进制显示)
说明:签名成功后,特定工具可以查看签名文件的内容,实际为二进制密文,在没有公钥的情况下,该密文无法解码。

[root@localhost ~]# hexdump iot_code.txt.md5.sign 
0000000 3a82 f857 97b8 bb23 5d43 9902 d398 f6ae
0000010 478e d1a0 4a03 ab62 07e2 794e c81c 71ac
0000020 0903 135e 8c7c b3e0 164b f0d2 5e21 0009
0000030 5623 e252 2b9b ce8c 6e33 2527 b34e cbf5
0000040 9257 b8b9 4c28 5981 7b46 e732 54d3 7fae
0000050 3949 f53c 69fc 8e24 fbb0 53a1 7df4 9278
0000060 fcce a728 01b6 d15c aa91 db52 0700 8b2f
0000070 dda9 14d0 f921 9747 c8c3 70b5 aa29 8045
0000080 4770 97b7 fd31 bb81 c865 0bda 8fd3 4ba8
0000090 e194 3e9c 7de5 9673 bcc9 1150 759f 0317
00000a0 2388 7898 fe8c 1133 4bdc 5337 96e1 0fc7
00000b0 b78f cd46 96e3 d1e4 9947 2a80 c9e9 ac14
00000c0 47df 0f0b c089 9897 dd03 926f 467f b2d3
00000d0 de24 f31c 3c91 d9a8 2e7a 7269 e1ad 2b1e
00000e0 3983 45b1 750b 939e 51b2 428d ef88 75df
00000f0 4e3b 33cb 1eda 11d4 b28d 44e7 82c6 6010
0000100
[root@localhost ~]#

第6步,使用签名者公钥验证签名有效性
说明:为了验证数据及数据签名的有效性(即数据文件和签名文件是否为合法有效的组合),需使用“公钥”信息对签名信息和数据文件进行验证。

[root@localhost ~]# openssl dgst -md5 -verify public.key \
> -signature iot_code.txt.md5.sign iot_code.txt
Verified OK
[root@localhost ~]#

第7步:使用签名者私钥验证签名有效性
说明:签名者自身亦有能力对自己签发的签名信息进行验证,与“公钥”验证不同之处在于,需要使用签名者的“私钥”进行验证。

[root@localhost ~]# openssl dgst -md5 -prverify private.key \
> -signature iot_code.txt.md5.sign iot_code.txt
Verified OK
[root@localhost ~]#

 

6 月 012021
 
(10 inches * 128 dpi) * (6 inches * 128 dpi) = 1280 * 768
(8 inches * 128 dpi) * (6 inches * 128 dpi) = 1024 * 768
(10 inches * 128 dpi) * (8 inches * 128 dpi) = 1280 * 1024

What Is DPI and What Are the Requirements for Different Industries?

For businesses investing in printing and scanning resources, it’s important to understand the project requirements. Balancing cost and output, and ensuring the right resources are applied to the requirements, isn’t always easy.

Investing in the wrong technology or services can mean wasted money. Implementing the wrong solution can put your business at risk and leave employees struggling with an inadequate solution.

We’ll look at dots per inch, or DPI, and how businesses can use it to determine the scope and requirements of printing and scanning services. We’ll also look at DPI as a baseline measure for certain industries and requirements, so you can scale and budget your services.

What Is DPI and How Is It Used?

DPI, or dots per inch, is a measure of the resolution of a printed document or digital scan. The higher the dot density, the higher the resolution of the print or scan. Typically, DPI is the measure of the number of dots that can be placed in a line across one inch, or 2.54 centimeters.

The higher the DPI, the sharper the image. A higher resolution image provides the printer and printing device more information. You can get more detail and greater resolution from an image with higher DPI.

A lower DPI will produce an image with fewer dots in printing. No matter how powerful your printer is, a low-resolution image doesn’t provide enough raw data to produce high-quality images. The ink will spread on the page, making the edges look fuzzy.

Similarly, a monitor will measure the pixels per inch, or PPI, of a video display. Typically, a printer must offer a higher DPI to match the color quality and resolution of a video display PPI. This is due to the limited range of colors in a print job.

DPI Printing and Industry Standards

Let’s review a few standards and guidelines for using DPI in printing services. Keep in mind, you’ll need a better, and more capable, printer or print service to deliver higher-quality and high-resolution printing output.

1. Low-Resolution Images

Low-resolution images are considered 150dpi and less. For print, 150dpi is considered low-quality printing, even though 72dpi is considered the standard for the web (which is why it’s not easy printing quality images straight from the web). Low-resolution images will have blurring and pixelation after printing.

For business purposes, low-resolution images are suitable for scanning text documents and storing records digitally. Internal office communication can be reproduced with a low resolution, but anything used outside the office should be higher than 150dpi. After all, the printing quality needs to represent your business.

2. Medium-Resolution Images

Medium-resolution images have between 200dpi-300dpi. The industry standard for quality photographs and image is typically 300dpi.

For businesses, producing an external document like a brochure, a booklet, or a flyer requires 300dpi. You might be able to get away with 250dpi if you are less concerned with the quality and resolution of the printing. Any marketing material or collateral produced should be, at a minimum, 300dpi. Booklets, pamphlets, reports, and sales sheets should all be printed at 250dpi-300dpi or more.

A good rule to follow is when in doubt, select a higher dpi for your material.

3. High-Resolution Images

Most businesses consider 600dpi and higher to be a high-resolution image or print. High-resolution images require more memory to store and can take longer to scan. Storing high-resolution images can quickly fill a hard drive or server. Many desktop printers can’t reproduce high-quality and high-resolution images. Professional print services are often the best solution for high-resolution images.

Keep in mind, there are diminishing returns for increasing the resolution of an image. Any print above 1,200dpi will deliver improvements that are practically unnoticeable to the naked eye. You won’t be able to see any difference between documents. Only professional photographers or artists with highly detailed work will need resolution that high.

Other Factors That Influence Print Quality

DPI isn’t the only factor that determines the resolution and print quality. Often, these other factors can have more impact on quality and resolution.

For example, sometimes users will change the resolution of an image in software like Photoshop. This will increase the DPI, but it won’t change or increase the quality of the image. The pixels in the image are larger, resulting in a pixelated, almost unprintable, image. This is known as upsampling.

The printer, and ink used in the printer, can also affect print output. Laser jet printers use a toner that doesn’t bleed into the paper, producing a crisper image. Inkjet printers will bleed, which can lower the appearance of dots per inch for a printed work.

What Is DPI and What It Means for You

Selecting the right DPI printing services and office technology is important. Dots per inch is one factor that can influence the efficiency and cost of print services. It’s important to identify your business requirements and scanning and printing needs before selecting print services.

What Is DPI and What Are the Requirements for Different Industries? – Donnellon McCarthy (dme.us.com)

5 月 302021
 
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time    : 2021/5/31 09:46
# @Author  : Harvey Mei <harvey.mei@msn.com>
# @FileName: pwdgen.py
# @IDE     : PyCharm
# @GitHub  : https://github.com/harveymei/

"""
Python 密码生成器
Python Password Generator
指定长度和复杂度的密码批量生成工具
PyCharm缩进,选中代码块按tab键或shift+tab键
批量注释或取消注释,选中代码按command+/键
"""

import string
import random
from datetime import datetime as dt


# https://docs.python.org/3/library/string.html
# https://docs.python.org/3/library/random.html
# 密码字符类型

# 不同等级密码字符组合列表
print("---------------\n"
      "Python 密码生成器\n"
      "---------------\n"
      "1)数字\n"
      "2)数字+小写字母\n"
      "3)数字+小写字母+大写字母\n"
      "4)数字+小写字母+大写字母+符号\n")

password_level = input("请选择密码复杂度等级:(建议为4)")
# 密码复杂度等级
if password_level == '1':
    level = string.digits
elif password_level == '2':
    level = string.digits + string.ascii_lowercase
elif password_level == '3':
    level = string.digits + string.ascii_lowercase + string.ascii_uppercase
elif password_level == '4':
    level = string.digits + string.ascii_lowercase + string.ascii_uppercase + string.punctuation
else:
    print("Error Input")
    exit()

length_input = int(input("请输入密码长度:(建议为12)"))
if length_input == '':
    length_input = 12

number_input = int(input("请输入生成数量:"))
if number_input == '':
    number_input = 1

# 在指定字符组合中取随机字符,循环,直到满足密码长度要求,打印结果
password_list = []
while number_input > 0:
    length = length_input  # 额外增加第三变量,防止嵌套循环length_input > 0第二次值为False的情况
    pwd = ''
    while length > 0:  # 循环指定次数拼接字符串
        pwd = pwd + level[random.randrange(0, len(level))]  # 随机传入字符串切片索引值
        length = length - 1  # 直到满足密码长度退出循环
    password_list.append(pwd)
    number_input = number_input - 1  # 直到满足密码生成数量退出循环

# 遍历列表写入文件
filename = dt.now().strftime("%Y%m%d%H%M%S") + ".txt"
with open(filename, 'wt') as f:
    for password in password_list:
        f.write(password + "\n")

print("\n----------\n"
      "密码生成完成!")
4 月 252021
 

启动接口异常

[root@localhost ~]# wg-quick up wg0
[#] ip link add wg0 type wireguard
Error: Unknown device type.
Unable to access interface: Protocol not supported
[#] ip link delete dev wg0
Cannot find device "wg0"
[root@localhost ~]#

手动加载内核模块异常

[root@localhost ~]# modprobe wireguard
modprobe: ERROR: could not insert 'wireguard': Required key not available
[root@localhost ~]#

禁用ESXi客户机Secure Boot的选项

重启系统后接口启动恢复正常

4 月 212021
 

命令行二维码工具qrencode包信息

[root@centos-s-1vcpu-1gb-nyc3-01 ~]# dnf info qrencode
Last metadata expiration check: 0:00:11 ago on Wed 21 Apr 2021 01:24:40 AM UTC.
Installed Packages
Name         : qrencode
Version      : 3.4.4
Release      : 5.el8
Architecture : x86_64
Size         : 35 k
Source       : qrencode-3.4.4-5.el8.src.rpm
Repository   : @System
From repo    : appstream
Summary      : Generate QR 2D barcodes
URL          : http://fukuchi.org/works/qrencode/
License      : LGPLv2+
Description  : Qrencode is a utility software using libqrencode to encode string data in
             : a QR Code and save as a PNG image.

[root@centos-s-1vcpu-1gb-nyc3-01 ~]#

准备内容文件

[root@centos-s-1vcpu-1gb-nyc3-01 ~]# echo "https://www.baidu.com/" > url.txt
[root@centos-s-1vcpu-1gb-nyc3-01 ~]# cat url.txt 
https://www.baidu.com/
[root@centos-s-1vcpu-1gb-nyc3-01 ~]#

生成文本二维码