摘要: 实现了添加节点,和一个debug函数,可以分层打印节点 参考https://www.jianshu.com/p/e136ec79235c 阅读全文
posted @ 2020-03-30 01:08 yyanbiao 阅读(420) 评论(0) 推荐(0) 编辑
摘要: package main import ( "math/rand" "time" "fmt" ) const ( P = 0.6 MaxLevel = 8 ) func randomLevel() int { i := 1 rand.Seed(time.Now().UnixNano()) for i 阅读全文
posted @ 2020-03-28 17:08 yyanbiao 阅读(376) 评论(0) 推荐(0) 编辑
摘要: #include <vector> #include <iostream> using namespace std; void quickSort(int* array, int start, int end) { if (start >= end) { return; } int i = star 阅读全文
posted @ 2020-02-15 18:19 yyanbiao 阅读(151) 评论(0) 推荐(0) 编辑
摘要: #include <vector> #include <iostream> using namespace std; //最大堆 void adjust(int i, vector<int>& array,int length) { while (i >= 0 && i < length / 2) 阅读全文
posted @ 2020-02-13 15:57 yyanbiao 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1.安装etcd。如果是cluster至少要三个节点,在官网上下载二进制包解压,编写配置文件,如果使用阿里云或腾讯云等,记得安全组里面开放端口2379、2380。 2.启动。命令行 etcd --config-file xxx.conf 3.golang 客户端 阅读全文
posted @ 2018-10-29 14:40 yyanbiao 阅读(3048) 评论(0) 推荐(0) 编辑
摘要: 1.当用户登录时,在redis中存储对应的权限,在openresty配置要进行控制的权限,解析成一颗树。 2.在用户访问api时,通过用户id在openresty中提取权限,和权限树进行比较。 阅读全文
posted @ 2018-10-29 14:21 yyanbiao 阅读(854) 评论(0) 推荐(0) 编辑
摘要: //通过Next函数实现嵌套,举例如下package mainimport "fmt"type A struct{ index int handles HandlesFunc}func (a *A) Handle(f HandleFunc){ a.handles=append(a.handles,f 阅读全文
posted @ 2018-03-30 15:07 yyanbiao 阅读(396) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2017-12-27 11:51 yyanbiao 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 红色部分为不同之处。代码编译 在x86_64的机器上 选择了32位模式 gcc -S 1.c -m32 默认cdecl int add(int a,int b,int c){ int sum = a+b+c; return sum;}; int main(void){ int c=add(1,2,3 阅读全文
posted @ 2017-12-12 13:53 yyanbiao 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 背景 :无意在c++的qq群里看了一个关于ip头部定义的讨论,我参与了一下,就扯到了大小端。后来我在看lua源码的时候,关于lua的number类型也扯到了双精度浮点数的表示。通过一个小的代码可以略微解答其中的3个知识点。1.浮点数怎么表示 2.由于精度问题浮点数不能判断相等 3.大小端的问题 阅读全文
posted @ 2017-11-07 17:40 yyanbiao 阅读(1382) 评论(0) 推荐(0) 编辑