• 淘宝把我的重定向到world.taobao.com

    我是参考https://haoel.github.io配置的路由拨VPN

    今天逛淘宝发现被跳转到world.taobao.com
    chrome看了下解析出来的www.taobao.com是中国的. traceroute www.taobao.com也都是中国的
    然后怀疑cookie引起的, 清了之后果然好了.

    但是我现在不记得刚才上淘宝是要看什么了.

  • brew安装应用时出错

    brew安装Python3 和 vim时, 都是报错

    ==> ./configure --prefix=/usr/local/Cellar/apr/1.5.2/libexec
    checking for suffix of executables...
    checking whether we are cross compiling... configure: error: in `/private/tmp/vim-7.4.2235/':
    configure: error: cannot run C compiled programs.
    If you meant to cross compile, use `--host'.
    See `config.log' for more details
    

    看github上面说是因为osx 10.11与老版本的xcode不兼容了

    解决:

    xcode-select --install
    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
    
  • go get files recursively using glob?

    golang官方的glob不能支持**代表递归
    https://github.com/golang/go/issues/11862
    https://github.com/driskell/log-courier/issues/285

    mattn给了一个他自己写的第三方库https://github.com/mattn/go-zglob

  • 在mac系统vim中绑定command键

    只能在macvim中, 才能对commnad组合键做映射. 就是command+c

    因为在CLI中, commnad键会被iterm/terminal等终端应用截获. Option也是需要一些额外的办法才能使用, 而且会有负作用.也是需要一些额外的办法才能使用.

    参考http://stackoverflow.com/questions/9450905/how-to-bind-vim-through-tmux-to-cmd-key/9451636#9451636

  • 今日单词

    discrete

    Breaking this down into discrete steps

    /dɪˈskriːt; dɪ`skrit/

    adj eparate; distinct 分离的; 截然分开的

    discrete particles

    a series of discrete events

  • 今日单词

    rapidity

    Things are happening with machine-gun rapidity: Brexit, the Turkish coup, Islamist massacres in France, the surrounding of Aleppo, the nomination of Donald Trump.

    /rəˈpɪdətɪ; rə`pɪdətɪ/

    n[U] 迅速 湍急

    with great rapidity

  • mesos scheduler与master通讯

    用的是http, 但是需要长链接. 服务器返回“200 OK” status code with Transfer-Encoding: chunked.
    所以如果一个Http库只能在链接close之后才解释, 这样的库不能用.

    因为接下来的通讯需要用另外一个链接,我们叫做第二个链接. master收到请求后, 对第二个链接回复202. 然后把真正的响应回复到第一个长链接中.

  • go-unpacking-array-as-arguments

    command := strings.Split("service nginx reload")
    cmd := exec.Command(command[0], command[1:]...)
    err := cmd.Run()
    
  • golang中select是同步的

    	glog.Info(data)
    	select {
    	case zevent := <-watch:
    		glog.Info(zevent)
    	}
    	glog.Info(data)
    

    select 是同步的, 打印出zevent之后, 再打印后面的data

  • nginx中location的匹配规则

    官方资料见 http://nginx.org/en/docs/http/ngx_http_core_module.html#location

    location语法是这样的 location [ = | ~ | ~* | ^~ ] uri { ... } , []里面的东西代表可有可无. 举一个例子

    location = / {
        [ configuration A ]
    }
    
    location / {
        [ configuration B ]
    }
    
    location /documents/ {
        [ configuration C ]
    }
    
    location ^~ /images/ {
        [ configuration D ]
    }
    
    location ~* \.(gif|jpg|jpeg)$ {
        [ configuration E ]
    }
    

    nginx在匹配路径之前, 会首先把uri中%XX这样格式的内容先解码, 然后把. ..转成绝对路径, 以及把多个//合并成一个/

    再说明匹配规则前, 还是先解释一下上面这个语法什么意思. ~ ~这两个代表uri是一个正则表达式, ~是大小写敏感, ~是大小写不敏感. ^~可不是正则的意思,后面会有解释. 其它情况下, uri代表一个路径前缀.

    匹配路径按以下规则进行:

    1. 先序遍历所有路径前缀, 记录下来. 然后按顺序遍历所有正则,选用第一个正则匹配成功的结果. 如果没有正则可以成功匹配, 选用最长长度的前缀路径.

    2. 如果最长的前缀路径有 ^~ 修饰符, 就不再进行正则匹配这一步了.

    3. 如果前缀路径有 = 修饰符, 不再继续寻找

    4. uri前面加一个@, 叫做 named location, 普通的请求不管他, 只用在一些内部的跳转上, 比如下面这样

       location / {
           error_page 404 = @fallback;
       }
      
       location @fallback {
           proxy_pass http://backend;
       }
      
    5. 如果一个前缀路径最后以/结尾, 而且请求被proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass, or memcached_pass中的一个处理, 这个情况比较特殊: 请求如果不以/结尾, 会返回一个301的重定向响应, 再最后加上/. 如果不想这样, 就要用 = 修饰符做精确匹配, 像下面这样

       location /user/ {
           proxy_pass http://user.example.com;
       }
       location = /user {
           proxy_pass http://login.example.com;
       }