See asyncio source code

[toc] Example: In [1]: import asyncio In [2]: async def f(i): ...: await asyncio.sleep(i) ...: print(i) ...: In [3]: async def func(): ...: tasks = [] ...: for i in range(10): ...: await asyncio.sleep(0) ...: print('create process parameter ', i) ...: tasks.append(asyncio.crea ...

Posted by ShanesProjects on Thu, 05 Dec 2019 09:14:47 -0800

Make a chat room with gorilla websocket

This demo implements: Message broadcasting Heartbeat detection Chat via command line The specific logic is in websocket.go The core here is the global variable aliveList, which is responsible for distributing messages to clients. Events are passed through channel s to reduce blocking A single link will be registered in the Livelist, and ConnL ...

Posted by coderage on Sun, 01 Dec 2019 05:49:22 -0800

Python? Faker creates fake data

Reprint: https://www.cnblogs.com/hellangels333/p/9039784.html faker creates fake data In our work, sometimes we need to forge some fake data. How to use Python to forge these seemingly true fake data? Python has a package called Faker, which can be used to easily forge names, addresses, phone numbers and other information. ...

Posted by james182 on Sat, 30 Nov 2019 10:09:12 -0800

Supervisor's installation and management of tomcat process under CentOS7

Before installation, please ensure that your server can access the Internet normally, and the firewall is closed. Turn off selinux 1. Supervisor installation yum install python-setuptools //Installation dependency easy_install supervisor mkdir /etc/supervisord.d/ //Create directory cd /etc/supervisord.d/ echo_supervisord_con ...

Posted by sunnypal on Sat, 30 Nov 2019 08:53:55 -0800

A tool for a long time in silence: supervisor

Note that since the supervisor cannot monitor the background program, all commands executed by the command need to be executed in the foreground, such as nginx: command = /usr/local/bin/nginx -g 'daemon off;' Talk about the benefits of this tool:Manage your process, terminate the automatic restart service process abnormallyTurn off the machine ...

Posted by nwoottonn on Fri, 29 Nov 2019 10:20:32 -0800

Python monitoring server edge -- psutil

In addition to installing some commonly used monitoring software, the monitoring of the server sometimes needs to run some shell or Python scripts; under the shell, you can use the system's own shell commands such as ps/free/top/df, and python can call subprocess and other modules to run shell commands, but it is more troublesome to do so. Here ...

Posted by cwetherbee on Fri, 29 Nov 2019 05:48:58 -0800

TOTP introduction and simple implementation based on C ා

Intro TOTP is a time-based one-time password generation algorithm, which is composed of RFC 6238 Definition. Different from the event based one-time password generation algorithm HOTP TOTP is time-based and has the following relationship with HOTP: TOTP = HOTP(K, T) HOTP(K,C) = Truncate(HMAC-SHA-1(K,C)) Among them: T: T = (Current Unix time - ...

Posted by Yippee on Sun, 24 Nov 2019 13:04:35 -0800

The problem of "bed allocation" -- the realization of C language array

Written in front It's hard to write ~ but teacher fan didn't even let me run ~ I'm dry!It adopts the storage mode of structure array. Title: bed allocation A hotel has N rooms, K rooms have a (k), and each room has B (k) single beds. The program of allocating beds for single passengers and withdrawing beds when leaving the hotel is designed by ...

Posted by czs on Thu, 21 Nov 2019 06:10:41 -0800

(Centos7) Supervisor installation and deployment

1.yum installation yum install epel-release yum install -y supervisor 2. Configuration fileAfter the supervisor is installed successfully, no default configuration file is provided. You can generate the initialization configuration file of the supervisor by running the echo supervisor conf program mkdir /etc/supervisor echo_supervisord_conf &g ...

Posted by Valdhor on Tue, 19 Nov 2019 12:13:26 -0800

Swoole learning notes: getting started with Hprose

1. What is RPCRPC is a way of communication between processes, the full name is "remote call procedure".When a client sends a request to the server, it is not sent directly to the target server, but to the RPC Server, which schedules it.RPC provides remote calling methods that are no different from calling local methods. 2. Introduct ...

Posted by Eddie Fisher on Sun, 17 Nov 2019 13:45:17 -0800