Skip to content

Instantly share code, notes, and snippets.

View niedbalski's full-sized avatar
Be humble and stay focused

Jorge Niedbalski niedbalski

Be humble and stay focused
View GitHub Profile
@niedbalski
niedbalski / mongodb_collection_sizes.js
Created April 28, 2020 16:46 — forked from freyes/mongodb_collection_sizes.js
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
# for juju on xenial
cat << EOF > /tmp/a.js
db = db.getSiblingDB('juju');
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'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); }
EOF
/usr/lib/juju/mongo3.2/bin/mongo --sslAllowInvalidCertificates --ssl -u admin -p $(grep oldpassword /var/lib/juju/agents/machine-0/agent.conf | awk -e '{print $2}') localhost:37017/admin /tmp/a.js
@niedbalski
niedbalski / build-tag-push.py
Created November 20, 2018 18:30 — forked from peatiscoding/build-tag-push.py
a script to convert your docker-compose.yml (version 2) with build node to image node; this script required DOCKERHUB_USER environment available.
#!/usr/bin/python
import os
import subprocess
import time
import yaml
import re
user_name = os.environ.get("DOCKERHUB_USER")
@niedbalski
niedbalski / setup-zeromq.sh
Created July 9, 2018 16:28 — forked from katopz/setup-zeromq.sh
Setup zeromq in Ubuntu 16.04
#!/usr/bin/bash
# Download zeromq
# Ref http://zeromq.org/intro:get-the-software
wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz
# Unpack tarball package
tar xvzf zeromq-4.2.2.tar.gz
# Install dependency
@niedbalski
niedbalski / setup-zeromq.sh
Created July 9, 2018 16:28 — forked from katopz/setup-zeromq.sh
Setup zeromq in Ubuntu 16.04
#!/usr/bin/bash
# Download zeromq
# Ref http://zeromq.org/intro:get-the-software
wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz
# Unpack tarball package
tar xvzf zeromq-4.2.2.tar.gz
# Install dependency
@niedbalski
niedbalski / maas_allocated_ip_addresses.sql
Created July 17, 2017 21:46 — forked from mpontillo/maas_allocated_ip_addresses.sql
List IP addresses allocated in MAAS.
SELECT
sip.ip,
CASE
WHEN sip.alloc_type = 0 THEN 'AUTO'
WHEN sip.alloc_type = 1 THEN 'STICKY'
WHEN sip.alloc_type = 4 THEN 'USER_RESERVED'
WHEN sip.alloc_type = 5 THEN 'DHCP'
WHEN sip.alloc_type = 6 THEN 'DISCOVERED'
ELSE CAST(sip.alloc_type as CHAR)
END "alloc_type",
package main
import (
"fmt"
"os"
"github.com/juju/utils"
)
const MIN_LEN = 30
@niedbalski
niedbalski / lxc-ssh
Last active May 4, 2016 19:34 — forked from freyes/lxc-ssh
#!/usr/bin/env python3
#
# Author: Felipe Reyes <[email protected]>
#
"""
Tool for SSH connect to a container using a given container name.
Usage:\n\t{0} [username@]container\n"
"""
## Workaround openstack nova+openvswitch mtu issues when no jumbo frames are available,
## by setting up udev at neutron-gateway to hook on routing interface creation and
## lowering the MTU
## See: https://blueprints.launchpad.net/neutron/+spec/network-options-mtu
## keywords: openstack, nova, openvswitch, mtu, 1500, no jumbo frames
## Create these two files:
#
# Varnish VCL file for Ghost blogging platform.
# http://ghost.org/
#
# Written for Ghost v0.3.0.
#
# This is a low-hanging-fruit type of VCL. TTL of objects are overridden to 2
# minutes, and everything below /ghost/ is pass()-ed so the user sessions
# work.
#