Python 使用 nacl 生成密钥对

import nacl.signing import nacl.public def generate_ed25519_keypair(): "return (public_key, private_key)" signing_key = nacl.signing.SigningKey.generate() pk = signing_key.verify_key._key sk = signing_key._signing_key return (pk, sk) def generate_curve25519_keypair(): "return (public_key, private_key)" sk = nacl.public.PrivateKey.generate() pk = sk.public_key return (pk, sk)

Install pip3 on Ubuntu

本文章引用自: https://www.educative.io/edpresso/installing-pip3-in-ubuntu ,版权归原作者所有。 pip3 is the official package installer for Python 3. It can be used to install packages from the Python Package Index. Installation Step 1 - Update systemIt is always a good idea to update before trying to install a new package. Run the command below: sudo apt update Step 2 - Install

pip 安装 Python 库到指定目录

可以使用 t (target) 选项来指定安装的位置。 举例: pip install -r requirements.txt -t /path/to/directory 安装到当前路径: pip install -r requirements.txt -t . 参考 https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-t

Python之禅

如何显示? import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face

AWS CLI S3 从存储桶下载和上传文件

可以使用 cp 复制,或 sync 同步,或者 mv 移动 https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html 单个文件的下载和上传下载文件 aws s3 cp <S3Uri> <LocalPath> 上传文件 aws s3 cp <LocalPath> <S3Uri> S3Uri 格式:s3://bucket-name/ob

AWS 在IAM控制台创建管理员账号

创建一个管理员账号 打开 IAM 控制台 ,选择创建一个管理员账号 Add User Access type 选上 Programmatic access Permissions 选 Attach existing policies directly。然后 Policy 选 AdministratorAccess 下一步,直到显示 Access Key ID 和 Secret Access Key 页

JS 生成随机字符串

Generate random characters Math.random().toString(36).replace(/[^a-z]+/g, '').slice(0, 5); Math.random(),生成随机数,例如:0.09751664076957856 .toString(36),转换成36进制后

Python 遍历指定目录下的文件

列出指定目录下的全部文件,或可以通过扩展名指定文件类型,也可以通过指定排除规则,忽略部分文件。 def list_files( dir: str, ext: list = None, recursive: bool = True, excludes: list = None ): """ Args: - dir, directory path.