1. OAuth 2.0 Bearer Token Usage

    引入

    在给Tornado编写豆瓣API的类时, 在查看文档时, 发现其access_token 并不像其它网站那样是传在query或者body中的. 而是放入headers中. 即: headers["Authorization"] = Bearer <access_token>

    搜索OAuth2.0 Bearer, 在RFC 6750中找到了详细介绍

    使用access_token方法

    标准中给出了3种access_token的使用方法:

    1. 使用headers的Authorization字段(格式如上)
    2. form字段形式放入POST请求的body中
    3. query形式放入url中

    标准推荐使用第一种方法. 第三种并不推荐, 因为access_token有可能泄漏.

    参考

    http://self-issued.info/docs/draft-ietf-oauth-v2-bearer.html

    Read more...


  2. right click menu items

    The list of program that is displayed when right-clicking on a file in PCManFM is the combination of: mimeinfo.cache mimeapps.list The default program that is launched when you double-click on a file in PCManFM is (first match wins): The one from ~/.local/share/applications/mimeapps.list The one ...

    Read more...


  3. The Little Redis Book 笔记

    query limitations, data structures and Redis' way to store data in memory

    strings

    use cases: storing objects (complex or not) and counters

    hashes

    hash suits for structed objects hash implemention

    sets

    in op is O(1)?

    use cases: Sets are great for tagging or tracking any other properties of a ...

    Read more...


  4. unpv13e chapter 3 notes

    IPv4 Socket Address Structure

    sockaddr_in.png

    Datatypes required by the POSIX specification

    datatypes.png

    Generic Socket Address Structure

    sockaddr.png

    IPv6 Socket Address Structure

    sockaddr_in6.png

    New Generic Socket Address Structure

    sockaddr_storage.png

    Comparison of various socket address structures.

    sockaddr_comparison.png

    Byte Ordering Functions

    byte_ordering_functions.png

    Convert Addresses Between ASCII Strings And Network Byte Ordered Binary Values

    Old Functions:

    inet_aton-inet_addr-inet_ntoa.png

    note 1: INADDR_NONE is typically ...

    Read more...


  5. mount and grep

    mount options

    mountdisplay current partions mount options. Output like this:

    /dev/sda2 on /home type ext4 (rw,relatime,data=ordered)
    /dev/sda5 on /media/sda5 type ext4 (rw,nosuid,nodev,noexec,relatime,data=ordered,user)
    /dev/sda7 on /media/sda7 type ext4 (rw,nosuid,nodev,noexec,relatime,data=ordered ...

    Read more...


  6. unpv13e chapter 2 notes

    Overview of TCP/IP protocols.

    unpv1_overview_TCP_IP_protocols.png

    TCP

    Three-Way Handshake

    TCP_three_way_handshake.png

    Packets exchanged when a TCP connection is closed.

    packets_exchange_when_TCP_connections_terminal.png

    TCP State Transition Diagram

    TCP_State_Transition_Diagram.png

    TIME_WAIT State

    Time: 2MSL

    Reasons:

    • To implement TCP's full-duplex connection termination reliably
    • To allow old duplicate segments to expire in the network

    SCTP

    SCTP four-way handshake

    SCTP_four_way_handshake.png

    Packets exchanged when ...

    Read more...


  7. Debian 环境下的 beaglebone black NFS client 配置

    不知什么时候手贱把beaglebone black刷成了Debian(Archlinux 没刷成功), 然后就放那了.

    今天要做实验, 就搭了下NFS.

    NFS Server 使用 Archlinux, 配置参见这里

    client 使用 Debian. 需要安装 nfs-common package

    配置 BB-black 联网:

    在板子下输入命令:

    /sbin/route add default gw 192.168.7.1
    echo "nameserver 114.114.114.114" >> /etc/resolv.conf
    

    在宿主机上输入:

    sudo iptables -A POSTROUTING -t nat -j MASQUERADE ...

    Read more...


  8. unpv13e chapter 1 notes

    struct sockaddr

    Everytime one of the socket functions requires a pointer to a socket address structure, that pointer must be cast to a pointer to a generic socket address structure. This is because the socket functions predate the ANSI C standard, so the void * pointer type was not available in ...

    Read more...


  9. 编译unpv13e源代码

    这里下载源代码,根据README进行编译.

    在make libfree下时需要修改inet_ntop.c, 将第60行的 size_t size 改成 socklen_t size.

    貌似Linux不支持4.4BSD style routing sockets, 所以不需要编译libroute

    测试intro/daytimetcpcli: ./daytimetcpcli 216.171.112.36

    而书上给的IP地址会一直block.

    Then start reading the famous classic book.

    Read more...


  10. history

    “我不喜欢历史”

    “你只是讨厌你的过去而已”

    语言对人的伤害仅次于身体的伤害。

    过去过去了,但它一直活在现在里。

    过去的事情有时候连自己都记不清楚,于是现在的你粉饰着,装点着你的过去。 直到你自己相信那是一段美好的恍若你亲身经历。

    但真实的过去永远在那,等待着机会吞噬你,吞噬你亲近的人。

    过去永远支配着现在的你,而现在又将过去。

    Read more...


« Page 2 / 3 »