Skip to content

Instantly share code, notes, and snippets.

View msplival's full-sized avatar

Mario Splivalo msplival

  • Zagreb, Croatia
  • 01:07 (UTC +01:00)
View GitHub Profile
dialmgo() {
agent=$(cd /var/lib/juju/agents; echo machine-*)
pw=$(sudo cat /var/lib/juju/agents/${agent}/agent.conf |grep statepassword |awk '{ print $2 }')
mongo --ssl --sslAllowInvalidCertificates -u ${agent} -p $pw localhost:37017/juju --authenticationDatabase admin
}
dialmgo() {
agent=$(cd /var/lib/juju/agents; echo machine-*)
pw=$(sudo cat /var/lib/juju/agents/${agent}/agent.conf |grep statepassword |awk '{ print $2 }')
/usr/lib/juju/mongo3.2/bin/mongo --ssl --sslAllowInvalidCertificates -u ${agent} -p $pw localhost:37017/juju --authenticationDatabase admin
}
@msplival
msplival / mongodb_collection_sizes.js
Last active March 13, 2018 06:44 — forked from joeyAghion/mongodb_collection_sizes.js
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
var mgo = db.getMongo()
function getReadableFileSizeString(fileSizeInBytes) {
var i = -1;
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
do {
fileSizeInBytes = fileSizeInBytes / 1024;
i++;
} while (fileSizeInBytes > 1024);
@msplival
msplival / deps.sh
Created June 13, 2017 08:09
CharmTests Dependencies (xenial+)
#!/bin/bash
PKGS=(
git
python-tox
python-virtualenv
libpython-all-dev
gcc
bzr
)
@msplival
msplival / collectionsFiles.js
Created June 13, 2017 07:20
List MongoDB collection filenames
function getcolfilename(colName) { return db.getCollection(colName).stats()["wiredTiger"]["uri"] }
db.getCollectionNames().forEach(function(n){ print(getcolfilename(n) + " " + n ) } )
package main
import (
"fmt"
"os"
"github.com/juju/utils"
)
const MIN_LEN = 30
#!/bin/bash -eux
# change this one if your gerrit remote user name is not the same as your
# shell user name
gerritusername=$USER
#gerritusername=mariosplivalo
repos=(
# supported charms as of 19.04 (https://docs.openstack.org/charm-guide/latest/1904.html#supported-charms)
charm-ceilometer-agent
charm-cinder