Skip to content

Instantly share code, notes, and snippets.

Coding at

fengmk2 fengmk2

Coding at
Block or report user

Report or block fengmk2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View simple.js
const delay = (time) => {
return new Promise(resolve => setTimeout(resolve, time));
const serviceFactory = (timeout) => {
return async () => {
await delay(timeout);
return timeout;
substack / server.js
Last active Oct 18, 2017
http method router
View server.js
var router = require('routes')();
router.addRoute("GET /articles/:title?", function (req, res, params) {
// perform some IO...
res.end('article content goes here...\n');
router.addRoute("POST /articles/:title", function (req, res, params) {
// perform some IO...
res.setHeader('content-type', 'text/plain');
res.end('updated ' + params.title + '\n');
hollodotme /
Created Apr 9, 2016
Install nginx with http2 support on ubuntu 14.04 LTS (Trusty)

How to install nginx (>= 1.9.5) with http2 support on Ubuntu 14.04 LTS (Trusty)

IMPORTANT: Backup your nginx site configs (usually under /etc/nginx/sites-available)!

Remove old nginx

Remove old nginx incl. nginx-common:

apt-get autoremove --purge nginx nginx-common
atian25 /
Created Mar 9, 2016 — forked from steve-jansen/
Stop and start Symantec Endpoint Protection on OS X

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


sudo curl -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
# the path where screenshots to save
# if you want to save them to your desktop, SS_PATH should be "/Users/YOURNAME/Desktop"
# a variable of unix timestamp for screenshot file name
NOW=$(date +%s)
# execute screen capture command, screenshot$NOW.png is the name of file
screencapture -i -r $SS_PATH/screenshot$NOW@2X.png
getify / gist:7ae82fdc2e86bf66bcba
Last active Jun 27, 2019
List of ES6 books either out or in progress...
View gist:7ae82fdc2e86bf66bcba
View gist:4294d5c212a6d2254703

From Fabrice Bellard, with minor name change (umulh):

// return the high 32 bit part of the 64 bit addition of (hi0, lo0) and (hi1, lo1)
Math.iaddh(lo0, hi0, lo1, hi1)

// return the high 32 bit part of the 64 bit subtraction of (hi0, lo0) and (hi1, lo1)
Math.isubh(lo0, hi0, lo1, hi1)

// return the high 32 bit part of the signed 64 bit product of the 32 bit numbers a and b
You can’t perform that action at this time.