go-位操作符
& 位运算 AND |
// 获取0-n之间的所有偶数 |
& 位运算 AND |
// 获取0-n之间的所有偶数 |
bnMultiplier := new(big.Int) |
A Set is a collection of values. You can iterate over those values, add new values, remove values and clear the set, get the set size, and check if the set contains an item. A value in the set might only be stored once, duplicates are not possible.
requiredClasses := mapset.NewSet() |
这本书更多的讲的是对脑相关影响因素的讲解,有哪些因素,为什么,哪些坏处等等常识性普及。
没有太多的实用价值。
睡觉,冥想,心情愉快即可。
primecoin pow 是寻找质数链,包括三种类型:
第一类坎宁安链,第二类坎宁安链,和孪生坎宁安链。
第一类坎宁安链的规则是,素数链中每个数都是前一个数的两倍减一。第一个长度为5的第一类坎宁安链包含以下5个素数:1531,3061,6121,12241,24481
第二类坎宁安链,素数链中每个数都是前一个数的两倍加一。第一个长度为5的第二类坎宁安链出现得更快,如下:2,5,11,23,47
最后,孪生坎宁安链的规则是:大小相差2的孪生素数,后一对的平均值是前一对的平均值的两倍。很容易理解,双坎宁安链具有偶数个数。第一个长度为6的双坎宁安链是:211049,211051,422099,422101,844199,844201
孪生坎宁安链本质上是第一类坎宁安链和第二类坎宁安链组合而成。每对的第一个数字组合正好是第二类坎宁安链,每对的第二个数字组合正好是第一类坎宁安链。
费马测试(费马小定理):
费马测试是一种快速辨别素数的方法:以任意数字(通常为2)为底,以需要测试的素数为幂,计算结果再用来减去该素数和一个大数的乘积,看是否得到原来的数字。
费马小定理:
如果 n 是一个素数,a 是小于 n 的任意正整数,那么 a 的 n 次方与 a 模 n 同余。(两个数称为是模 n 的同余,如果它们除以 n 的余数相同。数 a 除以 n 的余数称为 a 取模 n 的余数,或简称为 a 取模 n)。
怎么区分7.2和7.5的素数链长?
拿数列中第一个非素数,进行费马测试余数越小,分级长度越大。例如,我们的链2,5,11,23,47下一个值是95,依据上面使用的重复减法的过程计算后,余数是54,因此,链的长度为5+(95-54)/95=5.43。然而,1531……24481素数链的下一个值48961,费马余数为1024,所以链的长度为5+(48961-1024)/48961=5.97。为了一个为了使素数链可以成为有效的工作证明,它用小数表示的长度至少要和现在的难度想当。
我们不希望工作量证明可以重复使用,素数币还增加了另一种限制。基于素数币的目的,对于双向链的起点被定义为前面两个数字的平均,对于单坎宁安链的的起点被定义为假想双向链存在前面两数字的平均。例如,上面两个单坎宁安链的起点分别是1530和3。这样限制是因为素数列起点必须能够被工作证明的区块哈希数整除。哈希函数从属性看,寻找特定的散列值的唯一途径只能是采用简单地尝试新的值直到得到结果。因此,得到有效的工作证明的方法就是针对已知哈希值的区块寻找素数列,这些素数列只有对特定的区块才有效。
use vscode as ide for bitcoin
"program": "${workspaceRoot}/src/primecoind", //setup application path |
config build task will generate a file tasks.json"command":"BDB_PREFIX=/home/ubuntu/prime/db-4.8.30.NC/build_unix/build BDB_INCLUDE_PATH=${BDB_PREFIX}/include BDB_LIB_PATH=${BDB_PREFIX}/lib cd ${workspaceFolder}/src && make -f makefile.unix" |
crtl + shift + B to build. setup breakpoint and tap F5 run debugThe common use case for apt-cacher-ng is where you have a sizable network and
would like to speed up all the apt-get update calls made by your nodes,
especially if you are running chef or puppet periodically.
It is also used for complying to security policies that restrict internet access
to bulk of hosts except for a designated proxy server.
Apt-Cacher-NG是一个缓存代理服务(或者apt代理),对基于Debian的设备,如 Ubuntu, Kubuntu, Xubuntu, Edubuntu, Linux Mint等,它被是用来缓存已经下载过的包。
create docker file
# docker file for apt-cacher-ng service 2018.11.14 |
docker build -t apt_cache_ng_service . |
启动镜像,并且把端口映射到宿主机的3142上
docker run -d -p 3142:3142 --name apt_cacher_service apt_cache_ng_service |
可以使用docker命令来查看日志
docker logs -f apt_cacher_service |
登录浏览器查看
http://localhost:3142
sudo apt-get install apt-cacher-ng |
If everything went okay, then when visiting http://localhost:3142
you should see instructions on how to configure your clients to use the proxy.
HTTPS repositories:PassThroughPattern: .*
Client Proxy Configuration
There are two ways to tell apt-get to use your proxy:
Add this line to /etc/apt/apt.conf (or to a file named /etc/apt/apt.conf.d/00proxy):Acquire::http { Proxy "http://yourdomain.example:3142"; };
This tells apt to proxy all requests to that address and port.
deb http://ftp.debian.org/debian stable main contrib non-free |
deb http://yourdomain.example:3142/ftp.debian.org/debian stable main contrib non-free |
Note about Cache Visibility
It’s important to note that apt-get has it’s own internal cache, and is pretty good about not downloading the same indexes and packages over and over again. Unfortunately, this is at odds with apt-cacher-ng, as it cannot cache requests it never receives. You can force a download by clearing the contents of local caches (/var/cache/apt/* and /var/lib/apt/lists/*), then running apt-get update again to ensure that apt-cacher-ng sees all possible requests. Note: apt-get clean is not sufficient, as it only clears the local package cache, and not the index and list cache.
http://localhost:3142/acng-report.html?abortOnErrors=aOe&byPath=bP&byChecksum=bS&truncNow=tN&incomAsDamaged=iad&purgeNow=pN&doExpire=Start+Scan+and%2For+Expiration&calcSize=cs&asNeeded=an#bottom |
xxd 可以将镜像文件导出为 hex 格式
然后使用 diff 比较
xxd primecoind > primecoind.hex |
总体来说推荐阅读。
日本-和田秀树的作品,分了几个类别来说明应用的注意事项等。
提高干劲所需的心理学知识
三大法则:
建立职场人际关系所需的心理学知识
市场营销等
还是有些收获的。