Skip to content

Instantly share code, notes, and snippets.

View villadora's full-sized avatar

Wei Gao villadora

  • Ant,Tmall, DP, MS
  • Shanghai,China
View GitHub Profile
@villadora
villadora / guidetodatamining.md
Created August 20, 2012 02:17
book: 'a programmer's guide to data mining'
@villadora
villadora / jidan-30.md
Created August 29, 2012 04:45
激荡30年

柯达 98协议 收购当时国内7家企业中的6家 形成垄断,但如今却破产

@villadora
villadora / git-p4-sc.md
Last active December 10, 2015 04:18
git-p4 source code

git-p4.py

  • p4_build_cmd: 执行p4 commands时,用户可能并不希望在当前默认的环境下执行,而希望指定user, client等信息,而为了统一,并且省去每次都要输入一大堆p4参数的困扰,git-p4在对所有的p4 command ...调用都用p4_build_cmd进行包装,加上-u|-c|-p等参数。而这些参数又都是从gitConfig中获得的

  • gitConfig:这个方法很简单,只是利用git config命令获取属性的值并缓存到_gitConfig这个hash map中。git-p4利用了git自己的config设置来储存相关属性,如:'git-p4.user','git-p4.port','git-p4.client'等,这些属性都是以git-p4开头,方便进行管理。

  • main: 这个是程序的主入口,他的工作是分析命令行,获得要执行的命令,之后把控制转移到相关的类中。main里面用comands这样一个hash map来进行控制的跳转。

commands = {

@villadora
villadora / tail-rec.md
Created January 7, 2013 09:09
tail recursion

In traditional recursion, the typical model is that recursive calls are performed first, and then take the return value of the recursive call and calculate the result. In this manner, you don't get the result of calculation until you have returned from every recursive call.

In tail recursion, calculations are performed first, and then execute the recursive call, passing the results of current step to the next recursive step. The last statement is formed like"(return (recursive-function params))"

@villadora
villadora / linux-boot.md
Created March 22, 2013 14:03
linux boot

linux boot process:

  1. BIOS: 位于ROM中,全程是basic input output system,主要负责启动基本输入输出硬件,然后将管理权交给MBR

  2. MBR:

  3. grub/lilo: bootloader

  4. kernal

Boot Configuration Data

Boot Configuration Data (BCD) is a firmware-independent database for boot-time configuration data. It replaces the boot.ini that was used by NTLDR, and is used by Microsoft's new Windows Boot Manager.

Boot Configuration Data are stored in a data file that has the same format as the Windows Registry.[1] The file is located either on the EFI System Partition (on machines that use Extensible Firmware Interface firmware) or in \Boot\Bcd on the system volume (on machines that use IBM PC compatible firmware).

Boot Configuration Data may be altered using a command-line tool (bcdedit.exe), using Registry Editor (regedit.exe), using Windows Management Instrumentation, or with third party tools like EasyBCD.

Boot Configuration Data contain the menu entries that are presented by the Windows Boot Manager, just as boot.ini contained the menu entries that were presented by NTLDR. These menu entries can include:

note snippets

Jasmine测试

Jasmine的语法很简单,个人觉得比qunit稍微复杂点。但是好在可以直接在页面上集成测试,被测试的页面和测试结果显示在同一页面,非常方便。配合phantomJS那是相当舒服。jasmine-phantom

  • 测试页面与测试结果显示在同一页面,直接在测试页面上进行状态监测,使得测试更准确也更容易。

Fish Shell github

感觉很不错的一个shell, 有几个功能是非常吸引人的:

  1. Autosuggestions, 自动补全非常强大,可以自己轻松的设定。
  2. Web Configuration, 配置自己的颜色简单了,看到各种ansii码就头痛。

但是最成功的不是这些特性,而是他设计的时候就对于其他的shell来说是容易替换的,他提供额外的功能,但是不会改变你的日常行为。就在一台没有fish_shell的机器上你会觉得还ok,只是觉得不方便而已,不会觉得自己好像换了一个shell.