ARTS-week02
Algorithms
本周算法题:leetcode02
注意进位问题。
1 | /** |
Review
本周阅读英文文章:Choosing A Master Password
在密码强度上,应该选用一个主密码,根据不同的服务去按特定方式对主密码进行修改,这样每个网站的密码不一致,当某一网站发生泄露时,可以保证其他帐户的安全。
目前网站注册数量过多,最好将密码进行备份,存储为加密文件或者使用密码管理器(如LastPass,1Password,Dashlane,KeePassX等)。个人认为除了用户自己加强这方面的意识以外,各服务商也应该提供二次验证,备用码等方案。
密码熵:
In its simplest definition, password entropy is a measure of how unpredictable (or random) a password is. It is traditionally expressed in ‘bits’, where a bit is a binary digit representing two possible states (on or off, true or false, 1 or 0). For example, password with 10-bit entropy would be one that is equally likely to be one of any 1,024 possibilities (1,024 = 2¹⁰ = 2x2x2x2x2x2x2x2x2x2).
Technique
在学习Pytorch官方教程中Data Loading and Processing Tutorial中遇到BrokenPipeError: [Errno 32] Broken pipe
这个错误,反复确认代码没有问题后,开始搜索原因,疑似PyTorch的多线程库在Windows下工作还不正常,最后将num_workers的值由4改为0,工作正常。
环境:Windows10 64 Anaconda3 pytorch-cpu

解决该问题的链接:
https://github.com/pytorch/pytorch/issues/2341
https://zhuanlan.zhihu.com/p/26871672
Share
PythonCookBook
在迭代操作或者其他操作的时候,怎样只保留最后有限几个元素的历史记录?
保留有限历史记录使用collections.deque
。比如,下面的代码在多行上面做简单的文本匹配, 并返回匹配所在行的最后N行:
1 | from collections import deque |