今天无聊看了下微信PC端的文件,主要是想看UI是如何实现的。在文件列表里,竟然看到了 protobuf ,真是大吃一惊啊。然后又看到了qb_core.dll, 我想这个大概跟UI有关,于是搜索了下,发现原来是 QQBrowder 的组件。那么GUI似乎就很明显了——基于HTML + 浏览器核心的实现,类似Electron.
试着搜索了下实现,发现了一篇文章: 微信开源C/C++ RPC框架PhxRPC 于是了解到了这个名词。
# -*- coding: utf-8 -*- | |
"""when not package style, use sys path to easily append | |
""" | |
import sys | |
import pathlib | |
import contextlib | |
def _rel2abs(rel_path): | |
_dir_abs_path = pathlib.Path(__file__).absolute().parent |
#!/usr/bin/env python | |
# -*- coding: gb18030 -*- | |
import logging | |
def test_logging(): | |
"""test logging | |
add 2 handler for root logger! | |
""" | |
# config |
#!/usr/bin/env python2 | |
# -*- coding: gb18030 -*- | |
""" | |
naive shell interface | |
""" | |
import subprocess | |
import logging | |
import multiprocessing |
!/bin/sh | |
function is_line_num_equal() | |
{ | |
if [ $# -eq 0 ];then | |
return 0 | |
fi | |
line_cnt="`wc -l $1 | awk -F" " '{print $1}'`" | |
shift | |
while [ $# -ne 0 ]; do |
今天无聊看了下微信PC端的文件,主要是想看UI是如何实现的。在文件列表里,竟然看到了 protobuf ,真是大吃一惊啊。然后又看到了qb_core.dll, 我想这个大概跟UI有关,于是搜索了下,发现原来是 QQBrowder 的组件。那么GUI似乎就很明显了——基于HTML + 浏览器核心的实现,类似Electron.
试着搜索了下实现,发现了一篇文章: 微信开源C/C++ RPC框架PhxRPC 于是了解到了这个名词。
# http://stackoverflow.com/questions/3431825/generating-an-md5-checksum-of-a-file | |
import hashlib | |
def md5sum(filename, blocksize=65536): | |
hash = hashlib.md5() | |
with open(filename, "rb") as f: | |
for block in iter(lambda: f.read(blocksize), b""): | |
hash.update(block) | |
return hash.hexdigest() |
# change `rm` to `move` | |
mkdir -p ~/.trash | |
alias rm=trash | |
alias r=trash | |
alias rl='ls ~/.trash' | |
alias ur=undelfile | |
undelfile() | |
{ | |
mv -i ~/.trash/\$@ ./ |
# change it's name to .tmux.conf | |
# | |
# author : Xu Xiaodong <[email protected]> | |
# modified : 2015 May 10 | |
# | |
#-- base settings --# | |
set -g default-terminal "screen-256color" | |
set -g display-time 3000 | |
set -g escape-time 0 |
#include <iostream> | |
#include <vector> | |
#include <string> | |
using namespace std; | |
class SumSegmentTree | |
{ | |
public: | |
SumSegmentTree(const vector<int> &rawData) |
class Solution { | |
public: | |
int findMin(vector<int>& nums) { | |
if(nums.size() == 0){ return 0; } | |
int low = 0, | |
high = nums.size() - 1; | |
while(low < high) | |
{ | |
int mid = low + (high - low) / 2 ; | |
if(nums[mid] < nums[high]) |