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 / charmhead.sh
Created June 10, 2019 18:48
charmhead.sh
function charmhead() {
if [ ! ${#@} -ge 2 ]; then
echo "usage ./$0 charm revision" && return;
fi
q=$(curl -s https://api.jujucharms.com/charmstore/v5/$1-$2/archive/repo-info | python -c "import sys, re; q=map(lambda x: re.search('.*commit-short\: (.*)', x), sys.stdin.readlines()); print(q[1].group(1))")
if [ -n "$q" ]; then
echo "$q";
else
echo "Not found revision for charm: $1"
fi
@niedbalski
niedbalski / gist:c6bc61ec836a1ec55bbfd9336c4f228e
Created June 3, 2019 22:25
check that memcached is reacheable from ncc
#!/bin/bash
# ./{0} nova-cloud-controller
units=$(juju status $1 | grep -E '[a-z\-]+\/[0-9]+' | awk '{print $1}' | sed s'/.$//')
for unit in ${units}; do
relations=$(juju run --unit ${unit} 'relation-ids memcache')
for relation in ${relations}; do
unit_list=$(juju run --unit ${unit} "relation-list -r ${relation}")
for related in ${unit_list}; do
addr=$(juju run --unit ${unit} "relation-get -r ${relation} private-address ${related}")
@niedbalski
niedbalski / juju-pass.go
Created May 2, 2019 12:43
juju-pass.go
package main
import (
"fmt"
"os"
"github.com/juju/utils"
)
const MIN_LEN = 30
from jinja2 import Environment
import yaml
import sys
RULE_TPL = """
ALERT {{ alert }}
IF {{ expr }}
FOR {{ for }}
LABELS {
severity="page"
@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
# OpenSSL configuration for CRL generation
#
####################################################################
[ ca ]
default_ca = CA_default # The default ca section
####################################################################
[ CA_default ]
database = /config/auth/index.txt
crlnumber = /config/auth/crl_number
@niedbalski
niedbalski / quota-by-project.py
Created February 9, 2018 18:20
OpenStack Quota by project
#/usr/bin/env python3
# ./{0} cloud.linaro.cloud cloud.csv
from collections import OrderedDict
import shade
import sys
import csv
@niedbalski
niedbalski / latest-dockerhub-tag.py
Last active January 24, 2018 19:55
check the latest image tags for a particular dockerhub account
#!/usr/bin/env python3
import requests
import sys
base = "https://hub.docker.com/v2/repositories"
if len(sys.argv) <= 2:
(u, p) = ("linaro", "debian-source", )
else: