• 使用git部署网站

    |

    (Someone said a coder who’s blog is full of “using some tools to do sth” is totally unreliable….)

    大致方法是创建一个bare repository,然后利用hook脚本在每次push时更新网站内容。

    ##服务端

    创建git用户和,禁用shell登陆

    $ sudo useradd git && sudo groupadd git
    #创建并修改密码
    $ passwd git
    $ sudo vi /etc/passwd
    将git一行设置为:/home/git:/usr/bin/git-shell

    选一个喜欢的目录建立bare repository

    $ cd <path>
    $ mkdir website.git
    $ sudo git init --bare website.git
    #赋予给git用户
    $ sudo chown -R git:git website.git
    #配置hook
    $ sudo vi website.git/hooks/post-receive
    #!/bin/sh
    GIT_WORK_TREE=path/to/websiteroot git checkout -f
    $ chmod +x post-receive
    $ sudo chown -R git:git path/to/websiteroot

    之后便获取本地公钥,设置authorized_keys,之后网站更新时只要git push到repository即可。

  • 寒假快完了

    寒假快完了

    又一个寒假快完了

    大学第一个寒假,似乎和其余的假期并没有什么区别。

    也同样是睡睡睡,玩玩玩,浪浪浪。

    刚开始时在coursa上报的几门课后来都不了了之。。

    那一堆书虽然看了确也完全没有达到预期。

    连一直在练的那首rylynn都没有撸到头

    唯一的收获是撸了python?

    嗯还撸了个博客的前端。

    就这样吧= =

  • 博客迁移:使用hexo建站

    |

    神烦wordpress那一大堆奇怪的插件和功能,何况不懂后台优化的我看到wp页面加载时那几十条http请求就头大,于是毅然决然的始乱终弃(= =)了wp,转投静态博客。

    一番考虑之后选择了hexo。

    理由之一是易于部署,并且风评很好= =

    Blazing Fast

    Node.js brings you incredible generating speed. Hundreds of files take only seconds to build.

    Markdown Support

    All features of GitHub Flavored Markdown are supported. You can even use most Octopress plugins in Hexo.

    One-Command Deployment

    You only need one command to deploy your site to GitHub Pages, Heroku or other sites.

    Various Plugins

    Hexo has a powerful plugin system. You can install more plugins for Jade, CoffeeScript plugins.

    这便是官网的介绍。听着就很带感= =

  • C++ Has Become More Pythonic

    |

    原文:http://preshing.com/20141202/cpp-has-become-more-pythonic/

     

    C++ has changed a lot in recent years. The last two revisions, C++11 and C++14, introduce so many new features that, in the words of Bjarne Stroustrup, “It feels like a new language.”

    It’s true. Modern C++ lends itself to a whole new style of programming – and I couldn’t help noticing it has more of a Python flavor. Ranged-based for loops, type deduction, vector and map initializers, lambda expressions. The more you explore modern C++, the more you find Python’s fingerprints all over it.