0091-python好用的脚本

1:图片处理

1.1 截图

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/env python3
# encoding=utf-8


from mss import mss

import PIL.ImageGrab


def screenshot_1():
    """python 截屏方法1
    mss
    """
    with mss() as screenshot:
        screenshot.shot(output="scr.png")


def screenshot_2():
    """python 截屏方法2
    pillow
    """
    scr = PIL.ImageGrab.grab()
    scr.save("scr.png")


def main():
    print("this is main function")
    # screenshot_1()
    screenshot_2()


if __name__ == "__main__":
    main()
    print('__name__ value:', __name__)

1.2 将图像转换为素描图

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# 图像转换
import cv2
# 读取图片
img = cv2.imread("img.jpg")
# 灰度
grey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
invert = cv2.bitwise_not(grey)
# 高斯滤波
blur_img = cv2.GaussianBlur(invert, (7, 7), 0)
inverse_blur = cv2.bitwise_not(blur_img)
sketch_img = cv2.divide(grey, inverse_blur, scale=256.0)
# 保存
cv2.imwrite('sketch.jpg', sketch_img)
cv2.waitKey(0)
cv2.destroyAllWindows()

2:

3:

4:

5:

6:

7:

8:

9:

01-可观测性

云原生可观测性

1: OPLG 是什么

随着云原生架构的兴起,可观测的边界与分工被重新定义,传统的容器/应用/业务分层监控边界被打破,Dev、Ops、Sec 的分工逐渐模糊。大家意识到 IT 系统作为一个有机的整体,对 IT 系统状态的监测与诊断也需要一体化的方案。经过近几年的摸索与实践,基于 OPLG 的新一代云原生可观测体系,逐步成为了社区与企业的热门选择。

001-linux安装多版本python环境

1:简介

使用源码安装多个版本 python 环境,对系统原有 py 不影响

2:Linux 安装多个版本 python

2.1 下载 python 安装包

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
// ---------- python3.8 源码安装 --------------
// (1) 创建安装目录
mkdir -p /usr/local/python/python3.8
cd /usr/local/python/python3.8
// (2) 下载源码包
sudo wget  https://registry.npmmirror.com/-/binary/python/3.8.13/Python-3.8.13.tgz
tar -zxvf Python-3.8.13.tgz
cd Python-3.8.13
// (3) 配置要安装的目录
./configure prefix=/usr/local/python/python3.8 --enable-optimizations
// (4) 编译源码
sudo make -j8
// (5) make altinstall与make install的区别,altinstall skips creating the python link and the manual pages links
// https://blog.csdn.net/andylauren/article/details/108363030
sudo make altinstall



// python3.10
mkdir -p /usr/local/python/python3.10
cd /usr/local/python/python3.10
sudo wget https://registry.npmmirror.com/-/binary/python/3.10.6/Python-3.10.6.tgz

2.2 update-alternative 管理多版本 python

update-alternatives 命令用于处理 linux 系统中软件版本的切换

01-001-linux安装多版本python环境

1:简介

使用源码安装多个版本 python 环境,对系统原有 py 不影响

2:Linux 安装多个版本 python

2.1 下载 python 安装包

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
// ---------- python3.8 源码安装 --------------
// (1) 创建安装目录
mkdir -p /usr/local/python/python3.8
cd /usr/local/python/python3.8
// (2) 下载源码包
sudo wget  https://registry.npmmirror.com/-/binary/python/3.8.13/Python-3.8.13.tgz
tar -zxvf Python-3.8.13.tgz
cd Python-3.8.13
// (3) 配置要安装的目录
./configure prefix=/usr/local/python/python3.8 --enable-optimizations
// (4) 编译源码
sudo make -j8
// (5) make altinstall与make install的区别,altinstall skips creating the python link and the manual pages links
// https://blog.csdn.net/andylauren/article/details/108363030
sudo make altinstall



// python3.10
mkdir -p /usr/local/python/python3.10
cd /usr/local/python/python3.10
sudo wget https://registry.npmmirror.com/-/binary/python/3.10.6/Python-3.10.6.tgz

2.2 update-alternative 管理多版本 python

update-alternatives 命令用于处理 linux 系统中软件版本的切换

01-kafka

消息队列Kafka

1: Introduction

2: Arch 架构

3: 可视化 tools

1
2
//  kafka-map
https://github.com/dushixiang/kafka-map

01-有趣项目记录

有趣项目记录

1: 工具类

2: 好玩类

2.1 自动发送暖心邮件

1
https://github.com/Vincedream/NodeMail

2.2 土味情话生成器

1
https://github.com/zerosoul/honeyed-words-generator

3: 文件传输

1
2
3
// tl-rtc-file
// 用webrt在web端传输文件,支持传输超大文件, 分片传输,跨终端,不限平台,方便使用,内网不限速,支持私有部署
https://github.com/iamtsm/tl-rtc-file

4: 分布式文件系统

1
2
seaweedfs
https://github.com/seaweedfs/seaweedfs

5: 工具类

  • ctop

007-Python第三方库大全

部分转自:https://www.ctq6.cn/python%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%93%E5%A4%A7%E5%85%A8/#wsgi-%E6%9C%8D%E5%8A%A1%E5%99%A8

01-常见编程语言-如何在命令行编译并运行

常见编程语言-如何在命令行编译并运行

1 : Summary

2 : java 编译与运行

2.1 环境准备

  • 环境准备 安装 oracle java sdk ,或者 oracle open jdk ,然后将 java 可执行程序所在程序配置到 $PATH (windows 用户配置到 %path%)。
  • java open jdk 有非常多的版本,可通过 jabba 安装,版本非常全。 windows 用户安装了 scoop 的,可以使用 scoop 来安装,使用 scoop search jdk 会提示相应的步骤 macos/linux 用户还可以使用 jenv 来管理多版本。

2.2 编写代码

1
2
3
4
5
6
// hello.java
class Hello {
  public static void main(String[] args){
    System.out.println("I'm a Simple Program");
  }
}

2.3 编译运行

  • 命令javac hello.java && java Hello