Skip to content

Instantly share code, notes, and snippets.

View 058c37a272bed3464d47f0b01038a16a's full-sized avatar

058c37a272bed3464d47f0b01038a16a

View GitHub Profile
@058c37a272bed3464d47f0b01038a16a
058c37a272bed3464d47f0b01038a16a / stats.sh
Last active May 4, 2017 19:51
MongoDB script to print the document count, storage size and index size for all collections in all databases.
#!/bin/bash
# Created by RainoBoy97
# https://gist.github.com/RainoBoy97/9a63286e7c034a2ff8da68631ccd0898
mongo --quiet --eval '
db = db.getSiblingDB("admin");
var dbs = db.adminCommand("listDatabases").databases;
var totalCount = 0;

Keybase proof

I hereby claim:

  • I am rainoboy97 on github.
  • I am raino (https://keybase.io/raino) on keybase.
  • I have a public key ASDiEbqdbCoA9Y0CUDkMX0EDNdntVYMYYEeIixJBuZTySAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am RainoBoy97 on github.
  • I am raino (https://keybase.io/raino) on keybase.
  • I have a public key whose fingerprint is 1ACF 1227 B65B A509 ADF8 435F 244B 9ACA EA06 5925

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am rainoboy97 on github.
  • I am raino (https://keybase.io/raino) on keybase.
  • I have a public key ASAbRK5L3nfNpsjstHJrue_fwytc_qHMYo4yQGXJxMftvAo

To claim this, I am signing this object:

public static <T> T cast(Object object, Class<T> type) {
return cast(object, type, null);
}
public static <T> T cast(Object object, Class<T> type, T def) {
Check.notNull(object, "object cannot be null");
Check.notNull(type, "type cannot be null");
return isInstance(object, type) ? type.cast(object) : def;
}