September blog https://www.9ywk.com/ zh-CN "September blog" was established on September 15, 2016 (named September) website: www.9ywk.com , this site is non-commercial site, non-profit nature, for September personal blog. Most of them record life, personal feelings and some technical abstracts, or reprint and share some interesting things. Mon, 07 Jun 2021 20:38:00 +0800 Mon, 07 Jun 2021 20:38:00 +0800 Linux installing Python https://www.9ywk.com/python-1.html https://www.9ywk.com/python-1.html Mon, 07 Jun 2021 20:38:00 +0800 September https://www.python.org/ftp/python/

download

 wget  https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tgz

decompression

 tar -xf Python-3.9.5.tgz cd Python-3.9.5

Compile and install

 ./configure && make && make install

Wait patiently...

Check whether the version is installed successfully

 python3 -V

Establishing a soft link

At the end of the compilation, the program is usually installed in the /usr/local/bin lower
If Python - V does not display the version, create a soft link, which takes effect globally
Soft connection

 ln -s /usr/local/bin/python3.9 /usr/bin/python ln -s /usr/local/bin/python3.9-config /usr/bin/python-config

PIP command error

-bash: pip: command not found

Solution (CentOS version)

Download PIP script

 wget  https://bootstrap.pypa.io/get-pip.py

Python executes PIP script installation

 python3 get-pip.py

View PIP version

 pip -V

Uninstall Python 3

 rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps

Delete all remaining files

 whereis python3 |xargs rm -frv

View an existing installation of Python

 whereis python
]]>
zero https://www.9ywk.com/python-1.html#comments https://www.9ywk.com/feed/python-1.html
It's windy - you can buy hot noodles with coupons https://www.9ywk.com/369.html https://www.9ywk.com/369.html Thu, 06 May 2021 21:43:00 +0800 September After the author (who buys spicy strips also uses coupons) to get the copyright, he always feels that there is something missing.

Suddenly heard this song, let me suddenly recall that summer

Think of the past, is also a lot of emotion, but as time goes by

Lossless - the first version of the 18 years of feeling:: (HA HA)

{MP3 name = "lossless - first version" URL=“ https://cdn.9ywk.com/wx/ You can buy hot pepper with coupons. FLAC "cover =" https://p1.music.126.net/diGAyEmpymX8G7JcnElncQ==/109951163699673355.jpg ?param=130y130" theme="#404040" autoplay="autoplay"/}




{cloud title = "download song - windy" type = "default" URL=“ https://cdn.9ywk.com/wx/ You can buy hot pepper with Coupons - it's windy. FLAC "password] /}

]]>
zero https://www.9ywk.com/369.html#comments https://www.9ywk.com/feed/369.html
Record enterprise wechat parameters https://www.9ywk.com/360.html https://www.9ywk.com/360.html Wed, 14 Apr 2021 15:17:00 +0800 September parameter explain Access method AgentId Application ID Application interface corpsecret Application key Application interface corpid Enterprise ID Bottom of my business touser Member ID / account number @All represents all members of the enterprise media_ id Image media file ID Online access is valid for 3 days

F12 get media_ id

Management tools - Material Library - upload an image - F12 find the image URL. Request the media in the address_ id

]]>
zero https://www.9ywk.com/360.html#comments https://www.9ywk.com/feed/360.html
Updated down driver https://www.9ywk.com/358.html https://www.9ywk.com/358.html Wed, 07 Apr 2021 18:26:00 +0800 September Just download AI software, open the prompt Video: NVIDIA geforce 850, unsupported video driver

According to the repair tips, updated the next driver, perfect solution

NVIDIA driver download
https://www.nvidia.cn/Download/index.aspx?lang=cn

Just search. This is mine
 nvidia.png

When installing, choose the second one. I don't know how the first one will fail.
 nvidia-qudon.png

After installation, open AI, no prompt, click Help - system compatibility report - no conflict


Before OBS monitor capture, does not display the image, according to the online tutorial operation can not solve

Through this update It's amazing that OBS works

But still need simple settings, desktop right-click NVIDIA panel - manage 3D - program settings - Custom OBS - integrated image

QAQ: window capture chrome does not display
Chrome can turn off the hardware and speed up the restart

]]>
zero https://www.9ywk.com/358.html#comments https://www.9ywk.com/feed/358.html
Local projects are uploaded to GitHub via GIT https://www.9ywk.com/354.html https://www.9ywk.com/354.html Fri, 02 Apr 2021 16:14:00 +0800 September Download git installation
Install it by default, and then open the menu bar git bash

First installation configuration

 #Configure mailbox with the same account name git config --global user.name “Your_ github-Username” git config --global user.email “Your_ github-email” #View user name mailbox git config user.name git config user.email #You can also view the user's mailbox directly vim ~/.gitconfig : Q exit

Create SSH key
Since the transmission between the local git warehouse and GitHub warehouse is encrypted through SSH, you need to set it up when connecting

First look at your C disk user directory under the. SSH directory Hidden (C: users user name)
If yes, see if there is. SSH Private key ID_ RSA and public key ID_ rsa.pub These two files, if any, will jump to the next step. If not, they will be created by the following command

 ssh-keygen -t rsa -C "your_ github-email"

Just go back a few times

GitHub setting SSH key
Login to GitHub New SSH key

title content
Title Fill in as you like, for example, GIT
Key Generated: ID_ rsa.pub

Create empty warehouse (for uploading)
https://github.com/new

Other orders

git rm -r --cached .
Delete all files in the cache (note that if there is a space, if you change. To a file name, you will cancel a file)

Git upload

The remote warehouse is empty

(new warehouse, no readme. MD)

1. CD to the directory to be uploaded (local warehouse)
For example, in the test folder, PWD can view the current location

2. Initialize the local warehouse

 git init

A. Git folder will be created under the current test directory
This means making this folder a git manageable repository, a local repository that git uses to track and manage version libraries

3. Associate remote warehouse

 Git remote add origin GitHub warehouse HTTPS address

4. Add file to cache

 Git add. / / all contents in the current directory Git add user / / specify a file or folder Git status / / view cache file

(note that there is a space in this "." means that all the tests are submitted in this folder. You can also submit the specified file by git add

5. Submission instructions

 git commit -m 'first commit'

-The quotation mark after M is the comment content submitted this time. If it is not filled in, an error will be reported

6. Upload

branch

 Git branch XXX / / create branch Git branch - A / / view branch Git checkout XXX / / switch branches
 git push -u origin master

The remote warehouse is empty, so the parameter - u should be added to push the cached file to the master branch of GitHub warehouse

Remote warehouse is not empty

(old warehouses, including those without records)

1. Clone remote warehouse (download)

 Git clone warehouse address

2. CD to clone repository
➽ the cloned repository contains a. Git folder, which does not need git init initialization and associated remote repository address

3. Add file to cache

 Git add. / / all contents in the current directory Git add user / / specify a file or folder Git status / / view cache file

4. Submission instructions

 git commit -m 'first commit'

5. Upload

 git push origin master

Delete warehouse file

Local and remote deletion

 Git clone warehouse address //There is something to ignore Git RM file / / will be deleted locally Git RM - R folder / / will be deleted locally Git RM - RF. / / all local files will be deleted Git commit - M 'delete a file' git push origin master

If you do not want to delete the local file, only delete the corresponding part of the cache, add --cached

Delete remote warehouse only

 Git clone warehouse address //There is something to ignore Git RM -- cached file / / will not be deleted locally Git RM - R -- cached folder / / will not be deleted locally Git RM - RF -- cached. / / all local files will not be deleted Git commit - M 'delete a file' git push origin master

]]>
zero https://www.9ywk.com/354.html#comments https://www.9ywk.com/feed/354.html
Nginx + RTMP live streaming server https://www.9ywk.com/348.html https://www.9ywk.com/348.html Thu, 11 Mar 2021 15:50:39 +0800 September

This article is based on the pagoda panel

Uninstall nginx

The configuration of nginx RTMP and nginx is different, and the installation of nginx RTMP is not supported in the pagoda panel

Pre download nginx

 cd /www/server git clone  https://github.com/arut/nginx-rtmp-module.git #Git Error installing git: Yum - y install Git

Modify configuration (pay attention to format)

 vim /www/server/panel/install/nginx.sh

Add module: --add-module=/www/server/nginx-rtmp-module

Install nginx (a long time, can cooperate with screen)

 sh /www/server/panel/install/nginx.sh install 1.18

Create a website and remember the site directory

Modify nginx configuration

Setup configuration modification about 13 lines added

 rtmp { server { listen 6666; # Monitor the port, randomly change, after replacement remember square corresponding port chunk_ size 4000; application hls { live on; hls on; hls_ path /www/wwwroot/xx.com/live; # This is the live folder path hls_ fragment 5s; } } }

Overload, restart nginx

Push flow

Streaming address: rtmp://IP :port/hls

Play address: http://IP/live/ Streaming key.m3u8

The streaming key is set in the streaming client, such as obs

Firewall release port


This paper refers to: https://blog.csdn.net/qq_ 35774849/article/details/106334115

]]>
zero https://www.9ywk.com/348.html#comments https://www.9ywk.com/feed/348.html
Common commands of docker https://www.9ywk.com/368.html https://www.9ywk.com/368.html Fri, 05 Feb 2021 20:25:00 +0800 September Some basic commands are collected on the network

Docker installation: https://www.9ywk.com/344.html

Container management

View container name

 docker ps -a

Enter the container terminal

 docker exec -it name bash

Export a file of container

{alert type="success"}
Example: container name D, file name file.py, file.py path in / Python / file.py
Export file.py in container d to / root
{/alert}

Execute under root

 docker cp d:/python/file.py /root

docker

Version query
docker -v

start-up
systemctl start docker

Boot up
systemctl enable docker

stop it
systemctl stop docker

restart
systemctl restart docker

View status
systemctl status docker

Docker container directory
cd /var/lib/docker/containers

container

View all containers ා view all running containers
docker ps -a #docker ps

Stop a container
docker stop containerID

Start a container
docker start containerID

Restart a container
docker restart containerID

Stop all containers
docker stop $(docker ps -a -q)

Delete a container
docker rm containerID
Docker RM - F containerid ා force deletion

Delete all containers
docker rm $(docker ps -a -q)
Docker RM - f $(docker PS - A - Q) ා force deletion

image

View image
docker images
delete mirror
docker rmi imageID
Delete all mirrors
docker rmi $(docker images -q)

]]>
zero https://www.9ywk.com/368.html#comments https://www.9ywk.com/feed/368.html
Record the docker installation record https://www.9ywk.com/344.html https://www.9ywk.com/344.html Thu, 04 Feb 2021 13:00:00 +0800 September Official one click installation script! Linux system support!
Common commands: https://www.9ywk.com/368.html

 curl -sSL  https://get.docker.com/  | sh curl -fsSL  https://get.docker.com  | bash -s docker --mirror Aliyun #Start systemctl start docker #Self priming systemctl enable docker

Chinese version of portal

Create directory

 mkdir -p /data/portainer/data /data/portainer/public cd /data/portainer

download

 wget  https://d.ttit.win/linux/public.zip

Unzip to public

 unzip public.zip

start-up

 docker run -d --restart=always --name portainer -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v /data/portainer/data:/data -v /data/portainer/public:/public portainer/ portainer:latest

Initialize configuration via IP: 9000

docker-compose

 curl -L  https://github.com/docker/compose/releases/download/1.29.1/docker-compose- `uname -s`-`uname -m` -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose

1.29.1 Is the version number of docker compose. More versions can be referred to
https://github.com/docker/compose/releases

Determine whether the installation is successful

 docker-compose version

Boot up

If you want the docker compose container to start automatically, you need to create a startup script

Create a new one docker-compose-start.sh script
The script content is

 docker-compose -f /export/docker/docker-compose-nginx.yml up -d

-f /export/docker/docker-compose-nginx.yml Is the configuration file that specifies docker compose

Put the written script (. SH) in the directory /etc/profile.d/ After the system starts, all shell scripts in the directory will be executed automatically.

uninstall

 #Query installed packages [root@ ~]# yum list installed | grep docker docker-ce-cli.x86_ 64             1:20.10.2-3.el7                @docker-ce-stable #Uninstall docker-ce-cli.x86_ sixty-four [root@ ~]# yum -y remove docker-ce-cli.x86_ sixty-four

Finally, delete the container image
rm -rf /var/lib/docker

]]>
zero https://www.9ywk.com/344.html#comments https://www.9ywk.com/feed/344.html
Convert video to character video through Python https://www.9ywk.com/343.html https://www.9ywk.com/343.html Mon, 21 Dec 2020 20:11:00 +0800 September {dplayer src=" https://cdn.9ywk.com/wx/ywx.mp4 " /}

principle

  1. Export each frame of the video
  2. Convert each frame of picture into ASCII code
  3. The converted ASCII image is synthesized into video

For Python installation, refer to this article
https://www.9ywk.com/Python.html

Libraries to install for Python

opencv

 pip3 install opencv-python

pillow

 pip3 install pillow

After installing the library, place the video in the PY script folder and modify it video_ path After the parameter for your video path name can be run

 if __ name__ == '__ main__': video_ path = 'video/heiren.mp4' save_ pic_ path = 'cache_ pic' save_ charpic_ path = 'cache_ char'

The default exported video is .avi Format, you can modify about 107 lines of code, such as MP4

 video_ writter= VideoWriter('video/new_ char_ video.mp4' ,

source code

https://github.com/hongcyu/char_ painting

Final explanation

The script does not deal with audio and can be processed by other software.


]]>
zero https://www.9ywk.com/343.html#comments https://www.9ywk.com/feed/343.html
Windows install Python https://www.9ywk.com/Python.html https://www.9ywk.com/Python.html Sun, 20 Dec 2020 18:52:00 +0800 September Python installation

https://www.python.org

Download the python program from the official website to install it. Check the two option boxes below, and then click Customize installation Go to the next step
Add Python.. to path ා add environment variable
 python-install.png

take Install for all users Check the option, and the other options can be kept by default. Click browse, select the installation directory according to your needs, and click Install to install
 python-install2.png

Partial order

CMD Window execution

  1. python -V View version
  2. where python View installation location
  3. PIP list or pip freeze View installed Libraries
  4. PIP install library name Uninstall installed Libraries
  5. pip list --outdated View updatable third party libraries
  6. PIP install -- upgrade library name update library

If it appears Not an internal or external command See if the system variable is added. Generally, the system variable will be added automatically
Path: my computer - properties - advanced system settings - environment variables - system variables - path

Pip is slow to install the library?

The libraries we install are all downloaded from foreign sources. Sometimes the download is only tens of KB / s for lines and other reasons. We can switch the source to China to download.

Commonly used PIP domestic sources:

 Alicloud https://mirrors.aliyun.com/pypi/simple/ China University of science and technology https://pypi.mirrors.ustc.edu.cn/simple/ Douban https://pypi.douban.com/simple/ Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/ University of science and technology of China https://pypi.mirrors.ustc.edu.cn/simple/

Use the - I parameter
For example:

 PIP install library name - I https://mirrors.aliyun.com/pypi/simple/
]]>
zero https://www.9ywk.com/Python.html#comments https://www.9ywk.com/feed/Python.html