1. PEPS doc Kindle版本

    介绍

    Python上遇到的很多问题搜到最后经常链接到PEP, 觉得PEPS需要研读一下. 一时半会儿看不完的东西总想着放到Kindle里看(很有可能不会再看), 于是 就制作了这个mobi版本的Python Enhancement Proposals.

    下载地址

    过程

    hg clone下来, 然后转成html. 使用代码解析html, 用kindlegen生成 mobi文件.

    吐槽:

    1. Python官方积极推动代码移植到Python 3, 可peps中的转换代码都是 老版本的Python 2
    2. kindlegen的-c2选项很占用CPU, 且处理时间臭长, 但生成文件体积 变化并不大
    3. PEP的两种格式处理起来带来不少麻烦, 并且其生成的html文档结构 很简单, 没有程序处理需要的元信息.

    TODO

    本来应该按照分类做成类似期刊格式的文档, 但时间不够用, 没有制作 期刊的模板, 以后有时间再做.

    应该免去转成html那一步, 直接利用原生格式, 需要学习PEP文档的两种 格式.

    Python应该统一PEP格式, 把两种格式使用程序转成一种.

    Read more...


  2. 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...


  3. 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...


  4. 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...


  5. 天朝火车硬座的乱想

    明里着让你好好休息,然后光明正大的卖着什么租电影的服务,偏偏还有傻X, 愿意看“铁路工作人员”嘴里所谓的最新的电影。其实你想多了,让你好好休息 哪是对我们这些坐硬座的人说的。什么都有不一样,都有特权阶级。大家都想 着自己能成为所谓特权阶级的一分子,努力的往上爬,却丝毫不考虑这种设定 的合理不合理性。那人也整个是脑子里都是面糊,自己不睡觉,也不让大家睡觉。 自觉性,应该是与生俱来的品质了吧,但在大多数人身上却看不到一丁点。懊悔 自己没有超凡的能力,这样扰民的人就应该从火车上扔出去

    Read more...


  6. 换位置

    想着能在那个座位待到考研结束,也算是一种坚持。 但仅剩一个星期之际,却搞什么搬书移书,直接把 那间馆藏室给关了。又正值考试临近,换的位置感 觉不舒坦。图书馆里整个闹嗡嗡的,配上此天的心情, 也是一种滋味。

    Read more...


  7. 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...


  8. 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...


  9. 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...


  10. 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...


« Page 2 / 10 »