Skip to content

Instantly share code, notes, and snippets.

View fengmk2's full-sized avatar
:atom:
Coding at antgroup.com

fengmk2 fengmk2

:atom:
Coding at antgroup.com
View GitHub Profile
@fengmk2
fengmk2 / set-header.js
Created August 30, 2016 13:28
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 / 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 <fengmk2@gmail.com> (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 / co-leak.js
Last active February 19, 2016 19:30
co memory leak again
// "co": "~4.1.0",
var co = require('co');
var urllib = require('urllib');
var count = 0;
co(function* () {
while (true) {
try {
yield urllib.request('http://cnpmjs.org/mirrors/apis/iojs');
} catch (err) {
console.error(err);
@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 / npm-debug.log
Created January 24, 2014 04:24
node-gyp shasums check fail
$ nvm use 0.9.0
Now using node v0.9.0
mk2@~/git/node-gyp (shasums-check) $ ./bin/node-gyp.js install --verbose --disturl=http://dist.u.qiniudn.com
gyp info it worked if it ends with ok
gyp verb cli [ 'node',
gyp verb cli '/Users/mk2/git/node-gyp/bin/node-gyp.js',
gyp verb cli 'install',
gyp verb cli '--verbose',
gyp verb cli '--disturl=http://dist.u.qiniudn.com' ]
gyp info using node-gyp@0.12.2
@fengmk2
fengmk2 / names.txt
Created December 23, 2013 02:07
nodeparty 2013 hangzhou 抽奖名单
@coolme200
@melotlee
@wudi0431
@mjgaga
@lonfee88
@huxiangtao
@JacksonTian
@psw1254
@weakish
@xyhp915