Skip to content

Instantly share code, notes, and snippets.

Luke Arduini luk-

Block or report user

Report or block luk-

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 semver.js
// 1.0
semver.satisfies('2.1.0', '>2.x.x') // true
// 2.0
semver.satisfies('2.1.0', '>2.x.x') // false
@luk-
luk- / gist:6370833
Last active Dec 21, 2015
comma first json stringify via dominictarr
View gist:6370833
JSON.stringify(o, null, 2)
.split(/(,\n\s+)/)
.map(function (e, i) {
return i%2 ? '\n'+e.substring(4)+', ' : e
})
.join('')
View gist:6357761
{ "keys": ["super+shift+r"], "command": "reindent" }
View npm languages.md
  • German
  • French
  • Spanish
  • Japanese
  • Chinese (which?)
  • Korean
  • Russian
  • Italian
  • Arabic
View out.sh
writing "1234567890abcdef" 100 times
native : 4ms (25000 ops/s)
multilevel direct : 17ms (5882 ops/s)
stream.js:94
throw er; // Unhandled stream error in pipe.
^
stream.js:94
View master.js
var cluster = require('cluster')
var multilevel = require('multilevel')
var levelup = require('levelup')
var db = levelup('./data')
cluster.setupMaster({
exec: 'worker.js'
})
cluster.fork()
View gist:5365959
var record = {
id: idgen(20) ,
data: {
ip: parts[0],
agent: parts[1],
url: parts[2],
referrer: parts[3],
mobile: mobile
}
};
View fragmented.md

unix is not fragmented

darwin: lsof -i | grep LISTEN

solaris: lsof -p

linux: netstat -lnp

openbsd: netstat -nat | grep LISTEN

View readFileSync-bench.js
var fs = require('fs')
var _ = require('lodash')
var Benchmark = require('benchmark').Benchmark
var suite = new Benchmark.Suite
var filter = Benchmark.filter
suite.add('readFileSync#toString', function () {
var file = fs.readFileSync('./changelog').toString()
View socks.sh
$ ssh -D 0.0.0.0:5555 user@server.whatever
You can’t perform that action at this time.