Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jjo's full-sized avatar
🏠
Working from home

JuanJo Ciarlante jjo

🏠
Working from home
View GitHub Profile
uvtool: support multiple bridges, eg: --bridge br0 --bridge br1
live patching: patch -p0 -d /usr/lib/python2.7/dist-packages < /path/to/uvtool-multi-bridge.diff
=== modified file 'uvtool/libvirt/kvm.py'
--- uvtool/libvirt/kvm.py 2014-04-01 11:27:14 +0000
+++ uvtool/libvirt/kvm.py 2014-09-19 18:06:20 +0000
@@ -257,7 +257,8 @@
@jjo
jjo / gist:682caad81d15597d1739
Created September 24, 2014 19:30
keybase.md
### Keybase proof
I hereby claim:
* I am jjo on github.
* I am jjo (https://keybase.io/jjo) on keybase.
* I have a public key whose fingerprint is 0EFF 8F64 566F 06EF 52DE 81F9 09D5 FB6E 8050 D21C
To claim this, I am signing this object:
#!/bin/bash
# Manually setup juju mongodb clustering when failed from unresolvable hostnames,
# eg when using MaaS + LXC provisioning, see lp#1274947
set -u
SERVICE=${1:-mongodb}
echo "*** $SERVICE: checking clustered units..."
replset=$(juju get $SERVICE| python -c 'import yaml, sys;print yaml.load(sys.stdin)["settings"]["replicaset"]["value"]')
units=$(juju status $SERVICE | \
python -c 'import yaml, sys;print " ".join(sorted(yaml.load(sys.stdin)["services"]["'$SERVICE'"]["units"].keys()))')
# set positional parameters to $units, for easier handling (shift, $1, $2, etc)
@jjo
jjo / vip-units.sh
Created October 1, 2014 19:03
vip-units.sh: show juju unit holding the vip for each passed service, or --all // keywords: juju, openstack, ha, vip
#!/bin/bash
# vip-units.sh: show juju unit holding the vip for each passed service, or --all
# it forks for each service, to lower result times
#
# Author: JuanJo Ciarlante <jjo@canonical.com>
# License: GPLv3
#
# Show unit holding the vip, unfortunately can't use "crm foo"
# as it shows hostnames, which are useless for LXC over MaaS
services=${*:?missing service(s), eg: keystone cinder}
@jjo
jjo / juju-deployer-diff-fixes-for-services-without-units-and-single-valued-cfg-tags.diff
Last active August 29, 2015 14:08
juju-deployer/diff-fixes-for-services-without-units-and-single-valued-cfg-tags
=== modified file 'deployer/action/diff.py'
--- deployer/action/diff.py 2013-11-29 21:55:56 +0000
+++ deployer/action/diff.py 2014-10-22 16:51:05 +0000
@@ -30,7 +30,7 @@
'constraints'] = self.env.get_constraints(svc_name)
self.env_state['services'][svc_name][
'unit_count'] = len(self.env_status[
- 'services'][svc_name]['units'])
+ 'services'][svc_name].get('units',{}))
rels.update(self._load_rels(svc_name))
@jjo
jjo / heat-neutron-net.yaml
Last active August 29, 2015 14:09
HOT template to create a new neutron network plus a router to the public network
heat_template_version: 2013-05-23
description: >
HOT template to create a new neutron network plus a router to the public
network
parameters:
key_name:
type: string
description: Name of keypair to assign to servers
public_net:
@jjo
jjo / red.py
Last active August 29, 2015 14:17
#!/usr/bin/python
"RED (random early drop) simple implementation"
import random
import unittest
# pylint: disable=C0103,C0111,R0904
def request_ok(current, th_min, th_max):
"""return OK with a probability proportional to
'low' current, between th_min and th_max"""
Allows eg:
CLASSPATH=/path/to/hadoop-common-x.y.z.jar ant compile-native
diff --git a/build.xml b/build.xml
index cc9bfd0..b9da3e9 100644
--- a/build.xml
+++ b/build.xml
@@ -226,7 +226,8 @@
<mkdir dir="${build.native}/lib"/>
From 828996c831ee96947b785cfb8f376752ea02b69a Mon Sep 17 00:00:00 2001
From: JuanJo Ciarlante <jjo@google.com>
Date: Sun, 13 Sep 2009 13:43:04 +0200
Subject: [PATCH] * rebased openvpn-2.1_rc1b.jjo.20061206.d.patch
* passes {udp,tcp}x{v4,v6} loopback tests
* passes {udp,tcp}x{v6} remote tests
---
buffer.c | 13 ++
configure.ac | 16 ++
root@HOST:~# pgrep -f python.*nova-compute | xargs ps -fp
UID PID PPID C STIME TTY TIME CMD
nova 476997 1 2 Nov10 ? 04:14:01 /usr/bin/python /usr/bin/nova-compute --config-file=/etc/nova/nova.conf --config-file=/etc/nova/nova-compute.conf
root@HOST:~# strace -r -p "$(pgrep -f nova-compute)"
Process 3275 attached
Process 476997 attached
[pid 3275] 0.000000 restart_syscall(<... resuming interrupted call ...> <unfinished ...>
[pid 476997] 0.000080 epoll_wait(16, {}, 1023, 22) = 0
[pid 476997] 0.022212 epoll_wait(16, {}, 1023, 0) = 0