This file contains 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 { readJsonSync } | |
from "https://deno.land/std/fs/mod.ts"; | |
const repetitions = 100 | |
const dir = './testdata' | |
for(const file of Deno.readDirSync(dir)) { | |
const fileName = `${dir}/${file.name}` | |
const bytes = Deno.statSync(fileName).size | |
let i = 1, avg = 0 | |
for(; i <= repetitions; i++) { |
This file contains 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
alias gitadd='git ls-files -z -o --exclude-standard | xargs -0 git add' | |
alias gitadde='git ls-files -o --exclude-standard' | |
alias gitrem='git ls-files -z -d --exclude-standard | xargs -0 git rm' | |
alias gitreme='git ls-files -d --exclude-standard' | |
alias gits='git status' | |
function gitcom() { git commit -a -m "${*:-update}" && git push; } | |
# do this manually after the very first gitcom(): git push -u origin master | |
alias gitrel='if [ -n "$(npm version patch)" ]; then git push && git push --tags; fi' | |
alias gitlog='git log --oneline --decorate --graph' |
This file contains 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
var assert = require('assert'); | |
var len = 100000; | |
// create test clients, just empty objects | |
var sampleClients = []; | |
for(i = 0; i < len; i++) | |
sampleClients.push({ id: i }); | |
// create a randomized list for tests | |
var randomizedClients = sampleClients.slice(); |
This file contains 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
/* | |
node --max_old_space_size=3000 --prof nodemem.js | |
# --trace_incremental_marking=true --incremental_marking_steps=false | |
node --max_old_space_size=3000 --max_new_space_size=3000 --max_executable_size=1000 --gc_global --prof nodemem.js | |
# --noincremental_marking | |
# --nolazy_sweeping | |
# --never_compact |
This file contains 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
var fs = require('fs'); | |
var res = {}; | |
var base = process.cwd() + '/node_modules'; | |
var dirs = fs.readdirSync(base); | |
for(var i = 0; i < dirs.length; i++) { | |
var module = dirs[i]; | |
var bdir = base + '/' + module; | |
var cfg = bdir + '/package.json'; | |
var ok; |
This file contains 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
var ps = [ | |
'__defineGetter__', '__defineSetter__', 'valueOf', | |
'__lookupGetter__', '__lookupSetter__', | |
'constructor', 'hasOwnProperty', | |
'isPrototypeOf', 'propertyIsEnumerable', | |
'toLocaleString', 'toString' ]; | |
var o = {}; | |
for(var i = 0; i < ps.length; i++) |
This file contains 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
var http = require('http'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var constants = require('constants'); | |
var timers = require('timers'); | |
var port = 8080; | |
http.createServer(function(req, res) { | |
if(req.url == '/') { | |
res.writeHead(200, { 'Content-Type': 'text/plain' }); |
This file contains 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
require('winston/lib/winston/transports/loggly').Loggly.prototype.log = | |
function(level, msg, meta, callback) { | |
if(this.silent) | |
return callback(null, true); | |
var self = this; | |
/* | |
message = common.clone(meta || {}); |
This file contains 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
var winston = require('winston'); | |
winston.addColors({ | |
debug: 'cyan', | |
event: 'magenta', | |
fail: 'inverse' | |
}); | |
var log = new winston.Logger({ |
This file contains 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
var child_process = require('child_process'); | |
var forever = '/opt/local/bin/forever'; | |
var node = '/opt/local/bin/node'; | |
var bash = '/bin/bash'; | |
var mongod = '/opt/local/bin/mongod'; | |
var cwd = process.cwd(); | |
var procs = [ |