Skip to content

Instantly share code, notes, and snippets.

@mildcore
mildcore / speedtest-server-list.txt
Created August 21, 2021 20:13 — forked from stawidy/speedtest-server-list.txt
Speedtest 节点列表
17584) Chongqing Mobile Company (Chongqing, CN)
5726) China Unicom Chong Qing Branch (Chongqing, China)
5530) CCN (Chongqing, China)
19076) China Telecom (ChongQing, China)
20054) YunJinTianFu (Chengdu, China)
11444) University of Electronic Science and Technology of China (Chengdu, China)
2461) China Unicom (Chengdu, China)
4575) China Mobile Group Sichuan (Chengdu, China)
16398) China Mobile,GuiZhou (Guiyang, China)
5292) China Mobile Group Shaanxi Company Limited (Xi'an, China)
@mildcore
mildcore / Pycharm Keymap
Created July 18, 2020 09:18
Pycharm快捷键
常用快捷键
1、编辑(Editing)
Ctrl + Space:基本的代码完成(类、方法、属性)
Ctrl + Alt + Space:快速导入任意类
Ctrl + Shift + Enter:语句完成
Ctrl + P:参数信息(在方法中调用参数)
Ctrl + Q:快速查看文档
F1:外部文档
Shift + F1:外部文档,进入web文档主页
Ctrl + Shift + Z:Redo 重做
#!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
oneline if-else could be replaced by and/or
1. a if a else b -> a or b
2. f if a else g -> a and f or g # tricky though, so don't use, coz f must be true-like value.
"""
def f():

1. Editor -> File and Code Templates -> Python Scripts

#!usr/bin/python3
# -*- coding: utf-8 -*-

"""
@file:${NAME}.py
@time:${YEAR}/${MONTH}/${DAY}
@author:${USER}
"""
# closure_lambda_lazy
Closure:
内部函数引用的是外部函数的参数或变量,但是引用的是变量的最终值(外部函数的那次生命周期,外部函数可跨层级)
内层函数作为值返回时不会直接运算,等调用它的时候才会运算
看几个例子
# 1.Lazy, 另外内部函数引用了外部函数的参数,且外部函数生命周期已经结束不影响其使用.
>>> lazy_square_print = lambda i: lambda: print(i**2)
>>> square_print = lazy_square_print(5)
#! usr/bin/env python3
# -*- coding: utf-8 -*-
"""
aiomysql_bug_in_ResultProxy.py
aiomysql的官方例子在python 3.7中的async for问题,例子会报错
aiomysql 0.0.20
源码:
ResultProxy
#!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
关于async for 和 __aiter__、__anext__
old __aiter__ protocol, reutrn awaitable.
In 3.5.2 __aiter__ protocol was updated to return asynchronous iterators directly.
In CPython 3.7, the old __aiter__ protocol will no longer be supported: a RuntimeError will be raised
if __aiter__ returns anything but an asynchronous iterator.

1. pip basic use

upgrade:
python -m pip install --upgrade pip setuptools wheel
while pip unreachable/uninstalled:
python -m ensure pip
while pip upgrade itself failed:
remove the directory like "\Lib\site-packages\pip-20.0.2.dist-info"
摘要算法Digest
特点:不可反解,单向计算;固定长度,不会保存也无法恢复原有资源。
MD5 128bit # 不够安全
SHA1: 即SHA160, 160bit
SHA2: SHA-224、SHA-256、SHA-384、SHA-512、SHA-512/224、SHA-512/256等的统称
作用:
<1>一般是用来对密码进行加密存储【此加密非彼加密】,目的是防泄露密码明文。即便
一个网站密码库被黑客攻破, 也不会让用户其他网站帐号遭受危险;
<2>用来对一个资源生成摘要,接收者对资源也生成摘要来比对,防资源修改、缺失;
#!usr/bin/env python3
# -*- coding: utf-8 -*-
r"""
本代码的例子:一个扩展平面字符,CJK统一表意文字扩展B第一个字符。(你的环境可能无法正确显示,实际字符可自行搜索代码点)
https://unicode-table.com/en/20000/
𠀀
U+20000
1.Unicode编码标准