#Installing ngrok on OSX
- Download ngrok
- Unzip it to your Applications directory
- Create a symlink (instructions below)
Run the following two commands in Terminal to create the symlink.
# cd into your local bin directory
/** | |
* Created by lica on 6/12/2016. | |
*/ | |
function Map() { | |
this.container = new Object(); | |
} | |
Map.prototype.put = function (key, value) { | |
this.container[key] = value; | |
} |
function MyPromise(fn) { | |
this.resolve; | |
this.reject; | |
_this = this; | |
setTimeout(function () { | |
fn(_this.resolveFunc.bind(_this), _this.rejectFunc.bind(_this)); | |
}, 0) | |
} | |
MyPromise.prototype = { |
#Installing ngrok on OSX
Run the following two commands in Terminal to create the symlink.
# cd into your local bin directory
#!/usr/bin/env bash | |
set -e | |
# allow being run from somewhere other than the git rootdir | |
gitroot=$(git rev-parse --show-cdup) | |
# default gitroot to . if we're already at the rootdir | |
gitroot=${gitroot:-.}; | |
nm_bin=$gitroot/node_modules/.bin |
yum install -y m2crypto python-setuptools | |
yum install -y python-pip | |
pip install shadowsocks | |
vim /etc/shadowsocks.json | |
{ | |
"server":"0.0.0.0", | |
"server_port":8388, | |
"local_port":1080, | |
"password":"passwd", | |
"timeout":600, |
// Algorithm from http://csis.pace.edu/~wolf/CS122/infix-postfix.htm | |
function infixToPostfix(exp) { | |
const infix = exp.match(/(\*\*)|[\+\-\*\/\%\(\)]|([0-9]+([\.][0-9]+)?)/g); | |
const presedences = ['-', '+', '**', '*', '/', '%']; | |
let opsStack = []; | |
let postfix = []; | |
for (let token of infix) { | |
// 1. Print operands as they arrive. |
''' | |
moving avg,就是一个stream输入, | |
给一个int getNow()API获取当前timestamp, | |
完成两个函数void record(int value)和double getAvg(), | |
有输入时会自动call record,然后call getAvg()时返回5分钟内的平均值。 | |
getMedium -> quick select | |
''' | |
from collections import deque |
def summmaryranges(nums): | |
ranges = [] | |
for num in nums: | |
if not ranges or num - ranges[-1][-1] > 1: | |
ranges.append([]) | |
ranges[-1][1:] = [num] | |
return ['->'.join(map(str, r)) for r in ranges] | |
def reverse(l, r, cl): | |
while l < r: |