1. 安装screen
apt-get install screen
2. 列出当前所有的session
screen ls
3. 创建一个新的screen窗口
screen -S test
4. 退出当前窗口
可以使用ctrl+a,然后输入d,退出当前窗口; 也可以使用scree...
使用库:github.com/aws/aws-msk-iam-sasl-signer-python
安装方式参考:github.com/aws/aws-msk-iam-sasl-signer-python/blob/main/docs/installation.rst
最终代码:
#!/usr/bin/python3
from kafka ...
将本地文件复制到服务器:
scp localmachine/path_to_the_file username@server_ip:/path_to_remote_directory
这里的localmachine/path_to_the_file是本地文件的路径,username@server_ip是服务器的用户名...
新建文件mail.sh,输入内容:
#!/bin/bash
# 设置SMTP服务器地址、端口号、登录信息等参数
export EMAIL="810706080@qq.com"
export PASSWORD="123"
export RECIPIENTS=("xx@qq.com" "xx@aliyun.com")
...
syslog-ng 安装
sudo apt-get install syslog-ng
开放远程写入
修改配置文件:/etc/rsyslog.conf,放开对外提供服务的注释
# provides UDP syslog reception
module(load="imudp")
input(...
安装 ent 包
go install entgo.io/ent/cmd/ent@latest
生成初始化代码
在项目根目录创建目录:ent/schema
在schema目录创建空表代码文件 DrData.go:
type DrData struct {
ent.Schema
}
// Fiel...
测试机系统版本:Mac 12.6.6
前因:
因新的Mac系统移除了 python2,系统中只有 python3,但是 python3 必须使用 python3 指令才能执行,而对于部分工具如果调用python,只是执行python命令,系统中没有pyth...
执行命令:protoc --go_out=. param.proto 时,生成go文件报错,完整报错信息如下:
protoc-gen-go: program not found or is not executable
Please specify a program using absolute path or make sure the ...
#!/usr/bin/ruby
require 'openssl'
class AesEcb256
def encrypt(key, data, padding)
aes = OpenSSL::Cipher.new("AES-256-ECB")
aes.encrypt
aes.key = key
aes.padding = paddi...
logrus 仓库地址:https://github.com/sirupsen/logrus
实现代码:
func init() {
// 配置日志格式
logrus.SetReportCaller(true)
logrus.SetFormatter(&MyFormatter{})
logrus.SetL...
function format(date, format = "yyyy-MM-dd hh:mm:ss") {
//new Date 在 ios safari浏览器有兼容性问题处理如下:
// ? 兼容safari : 兼容其他浏览器
let $this = new Date(date) == 'Invalid D...
table, td{
border: 1px solid #000000;
border-collapse: collapse;
line-height:40px;
}
魔法方法
含义
基本的魔法方法
__new__(cls[, ...])
1. __new__ ...
#!/usr/bin/python3
import os
import paramiko
class DownFile(object):
ssh = paramiko.SSHClient()
def __exit__(self, exc_type, exc_val, exc_tb):
self.ssh.close()
...
安装依赖:
go get github.com/oschwald/geoip2-golang
数据库文件下载地址(需注册用户):
https://www.maxmind.com/en/accounts/current/geoip/downloads
示例代码:
type Result struct {
...