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
/** | |
* Created with IntelliJ IDEA. | |
* User: Alexander <estliberitas> Makarenko | |
* Date: 04.01.13 | |
* Time: 3:25 | |
*/ | |
'use strict'; | |
var fs = require('fs') | |
, net = require('net') |
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
wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb | |
sudo dpkg -i puppetlabs-release-trusty.deb | |
sudo apt-get update | |
sudo apt-get install puppet | |
sudo puppet resource service puppet ensure=running enable=true | |
sudo puppet resource cron puppet-apply ensure=present user=root minute=30 command='/usr/bin/puppet apply $(puppet apply --configprint manifest)' |
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
'use strict'; | |
function replacer() { | |
var objects = []; | |
return function(key, value) { | |
if (typeof value === 'object' && value !== null) { | |
var found = objects.some(function(existing) { | |
return (existing === value); | |
}); |
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
'use strict'; | |
module.exports = pool; | |
function pool(options) { | |
var instances = options.config.map(function() { | |
return null; | |
}); | |
function noop() { |
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 o = { | |
a: 1, | |
b: 2, | |
c: 3 | |
}; | |
Object.keys(o).reduce(function(out, key) { | |
out.push({ | |
key: key, | |
value: o[key] |
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 a = [{key: 'a', value: 1}, {key: 'b', value: 2}, {key: 'c', value: 3}]; | |
a.reduce(function(out, item) { | |
out[item.key] = item.value; | |
return out; | |
}, {}); // {a: 1, b: 2, c: 3} |
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
# Use following configuration to run ZooKeeper while executing tests | |
before_install: | |
# Add repository key | |
- "curl -s http://archive.cloudera.com/cdh4/ubuntu/precise/amd64/cdh/archive.key | sudo apt-key add -" | |
- "wget http://archive.cloudera.com/cdh4/one-click-install/precise/amd64/cdh4-repository_1.0_all.deb" | |
# Add Cloudera repository | |
- "sudo dpkg -i cdh4-repository_1.0_all.deb" | |
- "sudo apt-get update -qq" | |
# Install ZooKeeper |
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
// Below 3 versions of cool-lex loopless algorithm are listed. | |
// The only difference between them is data structure used to | |
// store a bit string: Number, Array, Buffer (node.js). | |
// | |
// Number version, as you may guess, will work properly for | |
// s + t < 32 thus bitwise / shift operators operate on 32bit | |
// integers. | |
function coollexArray(s, t, cb) { |
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
'use strict'; | |
// Use it like this: node gen-markdown-contents.js FILENAME | |
var fs = require('fs'); | |
var lines = fs.readFileSync(process.argv[2]).toString('utf8').split(/\n\r?/); | |
var links = {}; | |
var contents = lines.map(lineMapper).filter(Boolean).map(toListItem); | |
function getNextHash(link) { |
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
#!/usr/bin/env node | |
/** | |
* In private projects I usually keep changelog in README.md. | |
* | |
* It looks like: | |
* | |
* ## Changelog | |
* | |
* ### Version |
OlderNewer