Skip to content

Instantly share code, notes, and snippets.

@fengmk2
fengmk2 / set-header.js
Created August 30, 2016 13:27
set header benchmark
'use strict';
const OutgoingMessage = require('http').OutgoingMessage;
'use strict';
const Benchmark = require('benchmark');
const benchmarks = require('beautify-benchmark');
const suite = new Benchmark.Suite();
@fengmk2
fengmk2 / map-benchmark.js
Created May 2, 2016 06:22
Find out the faster way to create a simple map object https://cnodejs.org/topic/571e0c445a26c4a841ecbcf1
/**
* Copyright(c) node-modules and other contributors.
* MIT Licensed
*
* Authors:
* fengmk2 <[email protected]> (http://fengmk2.com)
*/
'use strict';
@fengmk2
fengmk2 / optimized-test.js
Created April 29, 2016 03:00
optimized-test.js
'use strict';
// http://dev.zm1v1.com/2015/08/19/javascript-optimization-killers/?spm=0.0.0.0.Rxyzi2
function testFn(a, b) {
const c = (a || 0) + (b || 1);
return c;
}
function printStatus(fn) {
@fengmk2
fengmk2 / README.md
Created April 7, 2016 14:43 — forked from atian25/README.md
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
# sysctl -a|grep tcp
net.ipv4.tcp_abort_on_overflow = 0
net.ipv4.tcp_adv_win_scale = 1
net.ipv4.tcp_allowed_congestion_control = cubic reno
net.ipv4.tcp_app_win = 31
net.ipv4.tcp_available_congestion_control = cubic reno
net.ipv4.tcp_base_mss = 512
net.ipv4.tcp_challenge_ack_limit = 100
net.ipv4.tcp_congestion_control = cubic
net.ipv4.tcp_dsack = 1
@fengmk2
fengmk2 / package.json
Created February 4, 2016 14:52
cnpmjs.org's package.json
{
"name": "cnpmjs.org",
"version": "2.7.1",
"description": "Private npm registry and web for Enterprise, base on MySQL and Simple Store Service",
"main": "index.js",
"scripts": {
"test": "make jshint && make test",
"start": "./bin/nodejsctl start && cp History.md docs/web/history.md",
"status": "./bin/nodejsctl status",
"stop": "./bin/nodejsctl stop"

☺️💕🙈😴😴😂

@fengmk2
fengmk2 / node-binaries-download-stats.md
Last active December 17, 2015 16:24
npm.taobao.org node binaries dowload stats in 2015-11 and 2015-12

$ sudo gunzip access.log.47.gz
$ sudo grep '/Nov' access.log | grep '/mirrors/node/'| grep -v 'docs'|grep 302|wc -l

2015-11-01 - 2015-11-30

Total: 20544

@fengmk2
fengmk2 / co-readable-all.js
Last active August 29, 2015 14:27
co readable example
'use strict';
const readable = require('co-readable');
const content = yield readable.all(fs.createReadStream('bigfile'));
@fengmk2
fengmk2 / test.html
Created June 13, 2015 03:15
test html
<!DOCTYPE html> <html> <head> <meta charset="gb2312"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>支付宝 知托付!</title> <meta name="keywords" content="支付宝,电子支付/网上支付/安全支付/手机支付,安全购物/网络购物付款/付款/收款,水电煤缴费/信用卡还款/AA收款,支付宝网站"> <meta name="description" content="支付宝,全球领先的独立第三方支付平台,致力于为广大用户提供安全快速的电子支付/网上支付/安全支付/手机支付体验,及转账收款/水电煤缴费/信用卡还款/AA收款等生活服务应用。"> <!--[if lte IE 7]>
<script type="text/javascript">
window.location.href = 'https://www.alipay.com/x/kill-ie.htm';
</script>
<![endif]--> <link href="https://a.alipayobjects.com" rel="dns-prefetch" /> <link href="https://app.alipay.com" rel="dns-prefetch" /> <link href="https://my.alipay.com" rel="dns-prefetch" /> <link href="https://lab.alipay.com" rel="dns-prefetch" /> <link href="https://cashier.alipay.com" rel="dns-prefetch" /> <link href="https://financeprod.alipay.com" rel="dns-prefetch" /> <link href="https://shenghuo.alipay.com" rel="dns-prefetch" /> <script type="text/javascript">
window._to = { start: new Date() };
</script> <script typ