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
/** | |
* Author: Jason White | |
* License: Public Domain | |
* | |
* Description: | |
* This is a simple test program to hook into PulseAudio volume change | |
* notifications. It was created for the possibility of having an automatically | |
* updating volume widget in a tiling window manager status bar. | |
* | |
* Compiling: |
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
'use strict'; | |
const DEFAULT_MIN_MERGE = 32; | |
const DEFAULT_MIN_GALLOPING = 7; | |
const DEFAULT_TMP_STORAGE_LENGTH = 256; | |
const POWERS_OF_TEN = [1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9] | |
const log10 = (x) => { | |
if (x < 1e5) { | |
if (x < 1e2) { | |
return x < 1e1 ? 0 : 1; | |
} |
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
'use strict'; | |
const quickSort = (arr, dimension, left = 0, right = arr.length - 1) => { | |
const len = arr.length; let index; | |
if (len > 1) { | |
index = partition(arr, dimension, left, right); | |
if(left < index - 1) quickSort(arr, dimension, left, index - 1); | |
if(index < right) quickSort(arr, dimension, index, right); | |
} | |
return arr; | |
}; |
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
'use strict'; | |
const fs = require('fs'); | |
const startTime = Date.now(); | |
const log = (msg) => setImmediate(() => { process.stdout.write(msg); }); | |
fs.readFile("/dev/stdin", 'utf8', (err, text) => { | |
const map = {}, sorted = [], lines = text.split("\n"); | |
for (let i=0; i<lines.length; i++) { | |
const words = lines[i].split(' '); | |
for (let j=0; j<words.length; j++) { | |
if (words[j].length === 0) continue; |