docker安装与搭建qqbot

前置知识:

  • 网络

  • python

docker安装与搭建qqbot

docker是什么

Docker 属于 Linux 容器的一种封装,提供简单易用的容器使用接口。 它是目前最流行的 Linux 容器解决方案。

Read more

OAuth 2.0

前置知识:

  • 网络

OAuth 2.0

令牌
 有时间范围,过期失效
 可以被所有者撤销,立刻失效
 有权限范围
令牌四种形式:
 授权码:
  先申请授权码,再用该码获取令牌
 隐藏式:
  直接发放令牌
 密码式:
  直接告诉密码
 凭证式:
  用于命令行,在命令行下请求令牌
令牌使用:
 请求头加上authorization字段
更新令牌:
 一次性发放两个令牌,一次用于更新,一个用

RESTful api设计

前置知识:

  • 网络

RESTful api设计

协议: https
域名:
 使用专有域名,如https://api.example.com
 简单,无扩展的话可以 https://expamle.com/api/
版本:
 放入url或http头 https://api.example.com/v1/
路径:
 只能有名词,与数据库表格名相对应,用复数形式,如 https://api.example.com/v1/zoos/
HTTP动词:
 GET (SELECT) 取出资源
 POST (CREATE) 新建资源
 PUT (UPDATE) 改变后的完整资源的更新
 PATCH (UPDATE) 改变资源属性
 DELETE (DELETE) 删除资源
 HEAD 获取资源原数据
 OPINION 知晓哪些属性可以改变
参数过滤:
 ?limit=10 返回记录数量
 ?offset=10 返回记录开始位置
 ?page=1&perpage=10 每页记录数
 ?sotredby=name&order=asc 排序
 ?x_type_id=1 筛选条件
Status Code:
 200 OK
 201 created
 202 accepted 已经进入排队 异步任务
 204 no content 删除成功
 400 invalid request 发出请求有错误
 401 unauthorized 无权限
 403 forbidden 授权但禁止访问
 404 not found 不存在
 406 not acceptable 请求格式不可得(要xml得到json)
 410 gone 永久删除
 422 unprocessable entity 创建对象时候验证错误
 500 internal server error 服务器发生错误
 502 bad gateway 服务器在充当网关或代理时,从其试图完成请求时访问的上游服务器接收到无效响应。
错误信息:
 返回键值对: error : xxx
返回结果:
 GET /collection: 返回资源对象的列表
  /collection/resource: 返回单个
 POST /collection: 新生成的对象
 PUT /collection/resource: 完整资源对象
 PATCH /collection/resource: 同上
 DELETE /collection/resource: 返回空文档
Hypermedia API:
 在返回结果中提供连接连向其他api,便于连向下一步
其他:
 身份认证用OAuth 2.0框架
 多用json

C++Primer Learning #0

写在前面:

C++Primer Learning预计会成为我的博客的一个系列,其中主要针对的是我个人对于C++语言的所不熟悉,不了解的部分,主要是个人的学习,所以更新内容不确定,对于C++Primer的部分内容会有省略。

目录:

待更新

To His Coy Mistress

To His Coy Mistress

by Andrew Marvel

Had we but world enough, and time,
This coyness, lady, were no crime.
We would sit down, and think which way
To walk, and pass our long love’s day.
Thou by the Indian Ganges’ side
Shouldst rubies find: I by the tide
Of Humber would complain. I would
Love you ten years before the Flood,
And you should, if you please, refuse
Till the conversion of Jews.
My vegetable love should grow
Vaster than empires, and more slow;
An hundred years should go to praise
Thine eyes and on thy forehead gaze;
Two hundred to adore each breast;
But thirty thousand to the rest;
An age at least to every part,
And the last age should show your heart;
For, Lady, you deserve this state,
Nor would I love at lower rate.
But at my back I always hear
Time’s wingèd chariot hurrying near;
And yonder all before us lie
Deserts of vast eternity.
Thy beauty shall no more be found,
Nor, in thy marble vault, shall sound
My echoing song: then worms shall try
That long preserved virginity,
And your quaint honour turn to dust,
And into ashes all my lust:
The grave’s a fine and private place,
But none, I think, do there embrace.
Now therefore, while the youthful hue
Sits on thy skin like morning dew,
And while thy willing soul transpires
At every pore with instant fires,
Now let us sport us while we may,
And now, like amorous birds of prey,
Rather at once our time devour
Than languish in his slow-chapt power.
Let us roll all our strength and all
Our sweetness up into one ball,
And tear our pleasures with rough strife
Thorough the iron gates of life:
Thus, though we cannot make our sun
Stand still, yet we will make him run.

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×