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
Developer Certificate of Origin | |
Version 1.1 | |
Copyright (C) 2004, 2006 The Linux Foundation and its contributors. | |
1 Letterman Drive | |
Suite D4700 | |
San Francisco, CA, 94129 | |
Everyone is permitted to copy and distribute verbatim copies of this | |
license document, but changing it is not allowed. |
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
//A recurse function to flatten a nested array | |
function flatten(input, output = []) { | |
input && input.forEach(element => { | |
if (element instanceof Array) { | |
//if found a array flatten it recursively | |
return flatten(element, output); | |
} | |
//if non-array element add it the output | |
output.push(element); | |
}); |
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 dbData = {} | |
db.adminCommand('listDatabases').databases.forEach(function(dBase){ | |
if( "admin" == dBase.name || "local" == dBase.name){ | |
return; | |
} | |
var currentDb = db.getSiblingDB(dBase.name) | |
var collData = {} | |
currentDb.getCollectionNames().forEach(function(collName){ | |
unusedIndexes = currentDb.getCollection(collName).aggregate([{"$indexStats":{}},{"$match":{"accesses.ops" : 0,"name" : {"$ne" : "_id_"}}}]).toArray() | |
if(unusedIndexes.length > 0){ |
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 | |
COLUMNS=300 | |
export COLUMNS | |
source_ips=( "10.0.0.1" "10.0.0.2" "10.0.0.3") | |
header=("Time" ${source_ips[@]}) | |
for value in "${header[@]}"; do | |
printf "%-8s\n" "${value}" | |
done | column -x | |
for i in $(seq -w 1 60); | |
do |