• WPAC file for windows 10

    Using socks instead of socket in windows 10,

    cat wpad.us:

    function FindProxyForURL(url, host)
    {
    if (isInNet(host, “172.16.0.0”, “255.240.0.0”)||
    isInNet(host, “192.168.0.0”, “255.255.0.0”)||
    isInNet(host, “10.0.0.0”,”255.0.0.0″)||
    isInNet(host, “127.0.0.0”,”255.0.0.0″)||
    isInNet(host, “comforthost.net”,”255.255.255.255″)||
    isInNet(host, “www.comforthost.net”,”255.255.255.255″)||
    isInNet(host, “panel.comforthost.net”,”255.255.255.255″)||
    dnsDomainIs(host, “.cn”)||
    dnsDomainIs(host, “.jd.com”)||
    dnsDomainIs(host, “.baidu.com”)||
    dnsDomainIs(host, “.taobao.com”)||
    dnsDomainIs(host, “.tmall.com”)||
    dnsDomainIs(host, “.springtour.com”))
    { return “DIRECT“; }
    if ( isInNet(host,”60.254.128.0”, “255.255.192.0”)||
    isInNet(host,”103.246.248.0″, “255.255.255.0”)||
    isInNet(host,”113.29.0.0″, “255.255.128.0”)||
    isInNet(host,”117.74.96.0″, “255.255.240.0”)||
    isInNet(host,”171.16.0.0″, “255.240.0.0”)||
    isInNet(host,”171.32.0.0″, “255.254.0.0”)||
    isInNet(host,”171.64.0.0″, “255.240.0.0”)||
    isInNet(host,”202.2.96.0″, “255.255.224.0”)||
    isInNet(host,”202.72.96.0″, “255.255.224.0”)||
    isInNet(host,”203.31.234.0″, “255.255.255.0”)||
    isInNet(host,”203.144.48.0″, “255.255.240.0”)||
    isInNet(host,”203.187.128.0″, “255.255.224.0”)||
    isInNet(host,”216.0.0.0″, “254.0.0.0”)
    )
    { return “SOCKS 127.0.0.1: 1080″; }
    if ( isInNet(host,”1.0.0.0″, “255.0.0.0”)||
    isInNet(host,”14.0.0.0″, “255.0.0.0”)||
    isInNet(host,”27.0.0.0″, “255.0.0.0”)||
    isInNet(host,”36.0.0.0″, “255.0.0.0”)||
    isInNet(host,”39.0.0.0″, “255.0.0.0”)||
    isInNet(host,”42.0.0.0″, “254.0.0.0”)||
    isInNet(host,”45.64.112.0″, “255.255.254.0”)||
    isInNet(host,”49.0.0.0″, “255.0.0.0”)||
    isInNet(host,”54.222.0.0″, “255.254.0.0”)||
    isInNet(host,”58.0.0.0″, “254.0.0.0”)||
    isInNet(host,”60.0.0.0″, “254.0.0.0”)||
    isInNet(host,”91.234.36.0″, “255.255.255.0”)||
    isInNet(host,”101.0.0.0″, “255.0.0.0”)||
    isInNet(host,”103.0.0.0″, “255.0.0.0”)||
    isInNet(host,”106.0.0.0″, “255.0.0.0”)||
    isInNet(host,”110.0.0.0″, “254.0.0.0”)||
    isInNet(host,”112.0.0.0″, “240.0.0.0”)||
    isInNet(host,”139.9.0.0″, “255.255.0.0”)||
    isInNet(host,”139.129.0.0″, “255.255.0.0”)||
    isInNet(host,”139.148.0.0″, “255.255.0.0”)||
    isInNet(host,”139.155.0.0″, “255.255.0.0”)||
    isInNet(host,”139.159.0.0″, “255.255.0.0”)||
    isInNet(host,”139.170.0.0″, “255.255.0.0”)||
    isInNet(host,”139.176.0.0″, “255.255.0.0”)||
    isInNet(host,”139.183.0.0″, “255.255.0.0”)||
    isInNet(host,”139.186.0.0″, “255.255.0.0”)||
    isInNet(host,”139.189.0.0″, “255.255.0.0”)||
    isInNet(host,”139.192.0.0″, “255.240.0.0”)||
    isInNet(host,”139.208.0.0″, “255.248.0.0”)||
    isInNet(host,”139.216.0.0″, “255.252.0.0”)||
    isInNet(host,”139.220.0.0″, “255.254.0.0”)||
    isInNet(host,”139.224.0.0″, “255.255.0.0”)||
    isInNet(host,”139.226.0.0″, “255.254.0.0”)||
    isInNet(host,”140.75.0.0″, “255.255.0.0”)||
    isInNet(host,”140.143.0.0″, “255.255.0.0”)||
    isInNet(host,”140.205.0.0″, “255.255.0.0”)||
    isInNet(host,”140.206.0.0″, “255.254.0.0”)||
    isInNet(host,”140.210.0.0″, “255.255.0.0”)||
    isInNet(host,”140.224.0.0″, “255.255.0.0”)||
    isInNet(host,”140.237.0.0″, “255.255.0.0”)||
    isInNet(host,”140.240.0.0″, “255.255.0.0”)||
    isInNet(host,”140.243.0.0″, “255.255.0.0”)||
    isInNet(host,”140.246.0.0″, “255.255.0.0”)||
    isInNet(host,”140.249.0.0″, “255.255.0.0”)||
    isInNet(host,”140.250.0.0″, “255.255.0.0”)||
    isInNet(host,”140.255.0.0″, “255.255.0.0”)||
    isInNet(host,”144.0.0.0″, “255.254.0.0”)||
    isInNet(host,”144.7.0.0″, “255.255.0.0”)||
    isInNet(host,”144.12.0.0″, “255.255.0.0”)||
    isInNet(host,”144.52.0.0″, “255.255.0.0”)||
    isInNet(host,”144.123.0.0″, “255.255.0.0”)||
    isInNet(host,”144.255.0.0″, “255.255.0.0”)||
    isInNet(host,”150.0.0.0″, “255.255.0.0”)||
    isInNet(host,”150.115.0.0″, “255.255.0.0”)||
    isInNet(host,”150.121.0.0″, “255.255.0.0”)||
    isInNet(host,”150.122.0.0″, “255.255.0.0”)||
    isInNet(host,”150.129.0.0″, “255.255.0.0”)||
    isInNet(host,”150.138.0.0″, “255.254.0.0”)||
    isInNet(host,”150.223.0.0″, “255.255.0.0”)||
    isInNet(host,”150.242.0.0″, “255.255.0.0”)||
    isInNet(host,”150.255.0.0″, “255.255.0.0”)||
    isInNet(host,”152.104.128.0″, “255.255.128.0”)||
    isInNet(host,”153.0.0.0″, “255.255.0.0”)||
    isInNet(host,”153.3.0.0″, “255.255.0.0”)||
    isInNet(host,”153.34.0.0″, “255.254.0.0”)||
    isInNet(host,”153.36.0.0″, “255.254.0.0”)||
    isInNet(host,”153.99.0.0″, “255.255.0.0”)||
    isInNet(host,”153.101.0.0″, “255.255.0.0”)||
    isInNet(host,”153.118.0.0″, “255.254.0.0”)||
    isInNet(host,”157.0.0.0″, “255.255.0.0”)||
    isInNet(host,”157.18.0.0″, “255.255.0.0”)||
    isInNet(host,”157.61.0.0″, “255.255.0.0”)||
    isInNet(host,”157.122.0.0″, “255.255.0.0”)||
    isInNet(host,”157.148.0.0″, “255.255.0.0”)||
    isInNet(host,”157.156.0.0″, “255.255.0.0”)||
    isInNet(host,”157.255.0.0″, “255.255.0.0”)||
    isInNet(host,”159.226.0.0″, “255.255.0.0”)||
    isInNet(host,”161.207.0.0″, “255.255.0.0”)||
    isInNet(host,”162.105.0.0″, “255.255.0.0”)||
    isInNet(host,”163.0.0.0″, “255.255.0.0”)||
    isInNet(host,”163.47.4.0″, “255.255.252.0”)||
    isInNet(host,”163.48.0.0″, “255.248.0.0”)||
    isInNet(host,”163.125.0.0″, “255.255.0.0”)||
    isInNet(host,”163.142.0.0″, “255.255.0.0”)||
    isInNet(host,”163.177.0.0″, “255.255.0.0”)||
    isInNet(host,”163.179.0.0″, “255.255.0.0”)||
    isInNet(host,”163.204.0.0″, “255.255.0.0”)||
    isInNet(host,”166.111.0.0″, “255.255.0.0”)||
    isInNet(host,”167.139.0.0″, “255.255.0.0”)||
    isInNet(host,”167.189.0.0″, “255.255.0.0”)||
    isInNet(host,”168.160.0.0″, “255.255.0.0”)||
    isInNet(host,”171.0.0.0″, “255.128.0.0”)||
    isInNet(host,”171.208.0.0″, “255.240.0.0”)||
    isInNet(host,”175.0.0.0″, “255.0.0.0”)||
    isInNet(host,”180.0.0.0″, “255.0.0.0”)||
    isInNet(host,”182.0.0.0″, “254.0.0.0”)||
    isInNet(host,”192.124.154.0″, “255.255.255.0”)||
    isInNet(host,”192.188.170.0″, “255.255.254.0”)||
    isInNet(host,”192.188.172.0″, “255.255.255.0”)||
    isInNet(host,”202.0.0.0″, “254.0.0.0”)||
    isInNet(host,”210.0.0.0″, “254.0.0.0”)||
    isInNet(host,”216.0.0.0″, “248.0.0.0”)||
    isPlainHostName(host)
    )
    { return “DIRECT“; }
    return “SOCKS 127.0.0.1: 1080″
    }

     

  • Regular Expression in C/C++

    SLRE:
    Super Light Regular Expression library
    An ISO C library that implements a subset of Perl regular expression syntax
    Simple API
    Dosen’t use heap

    T-Rex
    A minimalistic regular expression library written in ANSI C, supports the following POSIX expressions: ?,*,+,^,$,.,[a-b],() plus the perl style greedy closures {n} . It can be conditionally compiled to support 8-bits or 16-bits character strings.
    Uses heap

    TRE
    A lightweight, robust, and efficient POSIX compliant regexp matching library with some exciting features such as approximate (fuzzy) matching.
    PCRE
    Perl Compatible Regular Expressions
    heavyish, fully-fledged, Unicode support, industry-standard (used in Apache etc).

    RE2
    C++ library
    RE2 is a fast, safe, thread-friendly alternative to backtracking regular expression engines
    Oniguruma:
    Support different character encoding

  • awesome-cpp

    C/C++资源大全

    A curated list of awesome C/C++ frameworks, libraries, resources, and shiny things.

    https://github.com/fffaraz/awesome-cpp

    http://yanxin8.com/273.html

  • Hash Function

     

    • std::hash – C++11 standard library hash function
    • MurmurHash3 – Well known and used hash function
    • SpookyV2 – Alternative to Murmurhash3
    • Google Cityhash – Google attempt to improve on Murmurhash3
    • Google Farmhash  – Recent Google successor to Cityhash
    • cfarmhash – C port of Google Farmhash Hash64

     

     

  • 开源字体: source-han-sans (思源字体)

    source-han-sans (思源字体)

    Adobe 与 Google 联合开发的开源字体, 参见《Introducing Source Han Sans: An open source Pan-CJK typeface

    http://blog.typekit.com/

    下载:

    https://github.com/adobe-fonts/source-han-sans/

    许可:  1.001及其更早采用 Apache 2.0 license

    1.002及其以后采用 SIL Open Font License

     

    Google Noto Font:

    http://www.google.com/get/noto/

     

    https://github.com/googlei18n?query=noto

  • Update NO-IP DDNS

    Updating no-ip ddns on

    DDWRT Router:  

    with the help of inadyn tool

    https://github.com/torglobit/inadyn

     

     

     

    Linux box:

    With the help of noip-udc-linux

    http://www.no-ip.com/client/linux

     

    Failed Issus:

    No direct internet link

       DNS resolve too slow

    inadyn:   timeout=IP_DEFAULT_TIMEOUT=20s

    noip-udc:   using gethostbyname  linux api to get IP address,  the timeout can be defined in /etc/resolv.conf,  the default value in linux is 5 ms,

    Example of resolv.conf:

    nameserver 8.8.8.8 options timeout:30

     

     

  • Setup SSH VPN between two linux device

    https://help.ubuntu.com/community/SSH_VPN

    SSH_VPN

    work with ddwrt (with openssh+ ip installed)

     

     

     

  • Install VMWare ESXi HP MicroServer Gen8

    Install ESXi on hard disk:  Manage HardDisk with SSA, Launched from SPP

    Download HP SPP image from HP web site (http://blog.zhenglei.net/?p=254958)
    Create bootable USB disk with HP SPP image
    Update Firmware with SPP USB disk (Automatic)
    Create Logic disk with SPP USB disk (Interactive)

     

    Install ESXi on SD Card:  Select SD Card as the first Removable Media

    Power on
    Press  F9 during POST, Enter into Setup ROM Utility
    System Option / USB option

     


     

     Install ESXi

    1. Download VMware ESXi ISO image from HP/VMWare website
    2. Launch iLO4 remote console
    3. Mount Virtual DVD disk with VMware ESXi ISO image within iLO4 remote console
    4. Boot HP Gen8 Server with Virtual DVD disk
    5. Install VMware ESXi  (on SD disk)
    6. Reboot
    7. Download VSphere Client for Windows from http://MicroServer_NIC_IP
    8. Install VSphere Client into windows7 workstation
    9. Launch VSphere Client and Install Ubuntu 12 on virtual machine
    10. Generate VSphere License Key on Ubuntu  & register within VSphere Client
    •   sudo apt-get update
    •   sudo apt-get install wine
    •   sudo apt-get unrar
    •   wget http://blog.zhenglei.net/wp-content/uploads/2015/12/VMv6.rar
    •   unrar e VMv6
    •   wine KEYGEN.EXE
    •   Choose  VMware vSphere 6 Enterprise Plus & generate key
    •   Copy the generate key to VSphere client
  • build android kernel & sdk

    # List branches of rep
    git ls-remote file:///mirror/git/aosp/platform/manifest

    # Checkout Local copy
    repo init -u file:///mirror/git/aosp/platform/manifest
    repo sync -j18

    # List branches of local copy
    git –git-dir .repo/manifests/.git/ branch -a

    # Change branch
    repo init -b android-6.0.0_r5
    repo sync -j18

    # install tools
    sudo apt-get install git gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc

    # Install Oracle jdk1.7.0.xx into /opt/jdk1.7.0, and export