Skip to content

Instantly share code, notes, and snippets.

@arohter
arohter / umbrella
Created December 22, 2015 02:48 — forked from quinncomendant/umbrella
OpenDNS umbrella start/stop script for Mac OS X. This makes it easy to turn umbrella off temporarily, or get its status.
#!/usr/bin/env bash
# Quinn Comendant <quinn@strangecode.com>
# https://gist.github.com/quinncomendant/3be731567e529415d5ee
# Since 25 Jan 2015
# Version 1.1
CMD=$1;
if [[ `id -u` = 0 ]]; then
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
for (var c in stats) { print(
stats[c]['ns'] + ": " +
"total_size=" + Math.floor(stats[c]['size']/1048576) + " mb, " +
"idx_size=" + Math.floor(stats[c]['totalIndexSize']/1048576) + " mb, " +
"allocated=" + Math.floor(stats[c]['storageSize']/1048576) + " mb, " +
"num_docs=" + stats[c]['count']
);}