Skip to content

Instantly share code, notes, and snippets.

View robbie-cao's full-sized avatar

Robbie Cao robbie-cao

View GitHub Profile
今天发现 GitHub 有两步验证的功能,于是打算开启,可是悲剧的是,到了填写手机号的时候,发现没有 China 的选项。
于是我尝试了下修改网页源代码,添加了 `<option value="+86">China +86</option>` 再填手机号,居然就收到短信了。
后来有点不放心,还是给 https://github.com/contact 发了个反馈,然后收到回信说由于某些国家的短信发送成功率无法保证,所以没有开启两步验证功能。
不过在我这段时间的使用过程中,还是挺稳定的,每次都能收到短信。
大家如果也需要开启两步验证,最好把 Recover code 也记下来吧,避免以后短信收不到。
@robbie-cao
robbie-cao / libuv-vs-libev.md
Created January 3, 2017 12:12
libuv vs libev

libuv 和 libev ,两个名字相当相近的 I/O Library,最近有幸用两个 Library 都写了一些东西,下面就来说一说我本人对两者共同与不同点的主观表述。

高性能网络编程这个话题已经被讨论烂了。异步,异步,还是异步。不管是 epoll 也好,kqueue 也罢,总是免不了异步这个话题。

libuv是异步的,libev是同步的多路IO复用。

libev 是系统I/O复用的简单封装,基本上来说,它解决了 epoll ,kqueuq 与 select 之间 API 不同的问题。保证使用 livev 的 API 编写出的程序可以在大多数 *nix 平台上运行。但是 libev 的缺点也是显而易见,由于基本只是封装了 Event Library,用起来有诸多不便。比如 accept(3) 连接以后需要手动 setnonblocking。从 socket 读写时需要检测 EAGAIN 、EWOULDBLOCK 和 EINTER 。这也是大多数人认为异步程序难写的根本原因。

libuv 则显得更为高层。libuv 是 joyent 给 Node 做的一套 I/O Library 。而这也导致了 libuv 最大的特点就是处处回调。基本上只要有可能阻塞的地方,libuv 都使用回调处理。这样做实际上大大减轻了程序员的工作量。因为当回调被 call 的时候,libuv 保证你有事可做,这样 EAGAIN 和 EWOULDBLOCK 之类的 handle 就不是程序员的工作了,libuv 会默默的帮你搞定。

@robbie-cao
robbie-cao / active.md
Created December 30, 2016 00:24 — forked from paulmillr/active.md
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Fri, 19 Jun 2015 15:17:38 GMT till Sun, 19 Jun 2016 15:17:38 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 635)
@robbie-cao
robbie-cao / latex.md
Last active December 23, 2016 10:51
Test LaTeX in Markdown
<style TYPE="text/css"> code.has-jax {font: inherit; font-size: 100%; background: inherit; border: inherit;} </style> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ['\\(','\\)']], skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'] // removed 'code' entry } });
@robbie-cao
robbie-cao / Gravizo_Test.md
Last active December 13, 2016 04:22
Test Gravizo

<img src='http://g.gravizo.com/g? /** *Structural Things *@opt commentname *@note Notes can *be extended to *span multiple lines */ class Structural{}

@robbie-cao
robbie-cao / W(n, k)
Created November 29, 2016 10:25
W(n, k)
% function S=stirling(n,k)
%
% The number of ways of partitioning a set of n elements
% into k nonempty sets is called a Stirling set number.
% For example, the set {1,2,3} can
% be partitioned into three subsets in one way:
% {{1},{2},{3}};
% into two subsets in three ways:
% {{1,2},{3}}, {{1,3},{2}}, and {{1},{2,3}};
% and into one subset in one way:
@robbie-cao
robbie-cao / pubclient.cpp
Created October 14, 2016 06:28 — forked from kuenishi/pubclient.cpp
ZeroMQ sample codes
#include <zmq.hpp>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
int main (void)
{
zmq::context_t context(1);
const char * protocol =
"tcp://localhost:5555";
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Getting help:
-h -- print basic options
-h long -- print more options
-h full -- print all options (including all format and codec specific options, very long)
-h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter
See man ffmpeg for detailed description of the options.

H1

  • auto-gen TOC: {:toc}

H2.1

.blue { color: blue; }