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
#!/bin/bash | |
# Functions | |
get_current_branch() { | |
local branch_name=$(git symbolic-ref -q HEAD) | |
branch_name=${branch_name##refs/heads/} | |
branch_name=${branch_name:-HEAD} | |
echo "${branch_name}" | |
} |
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'; | |
const fs = require('fs'); | |
const readline = require('readline'); | |
const filename = process.argv[2]; | |
const stream = fs.createReadStream(filename); | |
const rl = readline.createInterface({input: stream}); | |
let currentLevel = 0; | |
const linkRevisions = {}; |
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'; | |
const fs = require('fs'); | |
const random = (max) => Math.round(1 + Math.random() * (max - 1)); | |
// Simple frame protocol: | |
// 4 bytes - frame length | |
// then read amount of bytes specified in frame length | |
const ws = fs.createWriteStream('parser.data'); |
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'; | |
// Usage | |
// node check-markdown-links.js path/to/markdown/file.md | |
// What it does: | |
// - Warns when `[ref][]` or `[title][ref]` style links don't have references defined on a page | |
// - Warns when `[ref]: URL` reference is not used anywhere | |
// - Warns when two `[ref]: URL` references point to same `URL` | |
// - Warns when `[ref]: URL` reference is defined in non-lexical order |
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
#!/bin/bash | |
# Hi guys! | |
# If it has happened with you and you got Bower dependencies | |
# and no `bower.json` file, and all you want is just have | |
# `bower.json` with those dependencies... | |
# You'll probably want to get those dependencies and their | |
# actual versions. And this is what simple command below does: | |
# Run it in a folder which keeps dependencies |
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
/** | |
* I had a task to get sets of vertices for multiple graphs | |
* given a set of edges. | |
* | |
* So if input looks like | |
* | |
* [A, B], [C, B], [D, C], [K, L], [Z, X], [M, L] | |
* | |
* Output should be | |
* |
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 |
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
// 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 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 |
NewerOlder