Skip to content

Instantly share code, notes, and snippets.

@mitechie
mitechie / cmr-demo.txt
Last active August 16, 2017 22:50
Cross model relations with K8 across regions and monitored on AWS
# get the latest juju edge snap
sudo snap refresh --edge juju
juju (edge) 2.3-alpha1+develop-c8d3e6c from 'canonical' refreshed
PATH=/snap/bin:$PATH
# turn on the Cross Model Relation feature flag
export JUJU_DEV_FEATURE_FLAGS=cross-model
juju bootstrap aws/us-west-2 west-noc
juju bootstrap google/europe-west1 eu-west-workloads
#!/usr/bin/env python
### Loops through your controllers and outputs the model version for each
### model on each controller.
### JAAS NOTE: if you're not actively logged into JAAS the script will fail
### until you auth. Rerun after authenticating and it should work on the
### second go.
import json
from subprocess import check_output
@mitechie
mitechie / juju-db
Created March 2, 2017 15:02
juju-db connection script
#!/bin/sh
# Usage: juju-db
# Connect to the database holding the state of the current Juju controller.
set -e
while [ $# -ge 1 ]; do
key="$1"
case $key in

Bookie: setup a Mac OSX local dev environment

I succesfully managed to setup a local development environment for Bookie in my Mac OSX machine and I'd like to share a few notes. The required changes are just small details and I guess it would be easy to edit the Makefile in order to make it work with Mac OSX, but actually I'm not an expert on it...

System configuration

OS: Mac OSX 10.8.5
Xcode: 4.6.3

Steps

  1. Manually install system libraries
@mitechie
mitechie / .gitconfig
Created December 9, 2013 15:11
Git tricks
###
### QA a pull request branch on remote: juju
###
# Pull info on the specified pull request from the origin remote, not your
# github fork. The pull request is not on your fork.
fetch-pr = "!f() { git fetch $1 refs/pull/$2/head:refs/remotes/pr/$2; }; f"
# git qa-pr juju 6 qa-sticky-headers
@mitechie
mitechie / gist:6132350
Created August 1, 2013 15:18
This isn't run/tested but a general refactor. What = \ ?
from kivy.adapters.dictadapter import DictAdapter
from kivy.uix.gridlayout import GridLayout
from kivy.uix.listview import ListItemButton
from kivy.uix.listview import ListView
from fixtures import fruit_categories
from fixtures import fruit_data
from fruit_detail_view import FruitDetailView as DetailView
@view_config(route_name='my-route')
def my_view(request):
# here i want to know if path-1 or path-2 was taken, preferably via a var n matchdict?
if request.view_name = 'my-route2':
# do extra work
config.add_route('my-route', '/path-1/view')
config.add_route('my-route2', '/path-2/view')
@mitechie
mitechie / test_quality.py
Created August 23, 2012 12:58
@voidspace Code quality checks: unittest test cases that use pep 8 and pyflakes and fail if any errors are found
import os
import pep8
from collections import defaultdict
from cStringIO import StringIO
from unittest import TestCase
from mock import patch
from pyflakes.scripts.pyflakes import checkPath
@mitechie
mitechie / jerry_commits.txt
Created April 21, 2012 01:00
list of commits in jerry's branch that need to be processed into readability_lxml
commit cec2d35c55cc8b94f0f6ff582cf700dab377af8a
Author: Jerry Charumilind <[email protected]>
Date: Tue Sep 13 10:38:13 2011 -0700
Increment version to 0.07dev
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit b646ea1ceacf66cc9d32baa432c08a3b5e7fc085

DataTable design overview

These are my early thoughts on how to structure DataTable in 3.5.0. Feedback is welcome in the comments. Test

Instantiable classes out of the box

new Y.DataTable({...});
new Y.DataTable.Base({...});