This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vagrant ssh -- -L 5858:127.0.0.1:5858 -N |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Partition file | |
FILE=/tmp/drive | |
# Mount directory | |
MOUNT=/mnt/drive | |
# Allocate 10Gb empty file | |
fallocate -l 10G $FILE | |
# Mount file to loop back device | |
losetup /dev/loop0 | |
# Create btrfs _without RAID_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"web-port": 8000, | |
"hidden": ["node_modules/", "tests/", "/node_modules/"], | |
"preload": true | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Snarfed from http://savannah.gnu.org/task/?6432 | |
// Ostensibly Copyright (c) 2007 Michele Bini, GPL | |
var c255lbase32chars = "abcdefghijklmnopqrstuvwxyz234567"; | |
var c255lbase32values = {"a":0, "b":1, "c":2, "d":3, "e":4, "f":5, "g":6, "h":7, "i":8, "j":9, "k":10, "l":11, "m":12, "n":13, "o":14, "p":15, "q":16, "r":17, "s":18, "t":19, "u":20, "v":21, "w":22, "x":23, "y":24, "z":25, "2":26, "3":27, "4":28, "5":29, "6":30, "7":31 }; | |
function c255lbase32encode(n, x) { | |
var c; | |
var r = ""; | |
for (c = 0; c < 255; c+=5) { | |
r = c255lbase32chars.substr(c255lgetbit(n, c) + c255lgetbit(n, c+1)*2 + c255lgetbit(n, c+2)*4 + c255lgetbit(n, c+3)*8 + c255lgetbit(n, c+4)*16, 1) + r; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extend class | |
function extend (proto) { | |
var Super = this; | |
var ctor; | |
if (proto.hasOwnProperty('constructor')) { | |
ctor = proto.constructor; | |
} else { | |
ctor = function () { | |
Super.apply(this, arguments); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function(){ | |
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | |
/* SHA-256 implementation in JavaScript (c) Chris Veness 2002-2014 / MIT Licence */ | |
/* */ | |
/* - see http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html */ | |
/* http://csrc.nist.gov/groups/ST/toolkit/examples.html */ | |
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | |
/* jshint node:true *//* global define, escape, unescape */ | |
'use strict'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Monomorphic x 1,989 ops/sec ±1.90% (71 runs sampled) | |
Megamorphic x 47.27 ops/sec ±1.03% (58 runs sampled) | |
Typed x 2,550 ops/sec ±2.10% (57 runs sampled) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Benchmark = require('benchmark'); | |
const suite = new Benchmark.Suite; | |
// Test data set size | |
const n = process.env.SET_SIZE || 100000; | |
// Megamorphic objects array | |
const objects = Array(n); | |
// Array of map instances | |
const maps = Array(n); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// Stdin JSON prettifier | |
// Partially based on https://gist.github.com/kristopherjohnson/5065599 | |
const {inspect} = require('util'); | |
const {stdin, stdout} = process; | |
var input = ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Router from 'koa-router'; | |
export function moduleMiddleware(options = {}) { | |
const router = new Router(); | |
router.get('/', async (ctx, next) => { | |
// ... do some job | |
}); | |
return router; |