This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Usage: | |
# ./os-nova-pause.sh pause | |
# | |
# Note: remember to define the environment variables used by the openstack clients | |
# typically this is done sourcing a 'openrc' file (you can download it from horizon) | |
# | |
function mod_server { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# Usage exmaple: | |
# ./prepare-vip.sh 10.5.0.107 port1,port2,port3 foo_net | |
# | |
# This will prepare the vip 10.5.0.107 to be used by machines in ports `port1`, `port2` and `port3` | |
# in the the next `foo_net`0 | |
PROG=$0 | |
VIP="$1" | |
PORTS="$2" | |
PRIV_NET=${3:-"freyes_admin_net"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/usr/bin/lxc-clone.real $@ | |
RET=$? | |
# hostname will be of the form juju-FOO-machine-NUM | |
X=$(hostname | cut -d'-' -f4) # here we grab NUM | |
# the 4th argument to lxc-clone is the new container's name that looks like juju-machine-NUM-lxc-CONTAINER_ID | |
COUNTER=$(echo $4 | cut -d'-' -f 5) | |
NEW_IP="10.5.${X}0.$(( $COUNTER + 20 ))" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from gi.repository import Gtk, Gio, GLib | |
IBUS_TO_GNOME = {'xkb:us::eng': ('xkbd', 'us'), | |
'xkb:us:intl:eng': ('xkbd', 'us+intl')} | |
def on_changed(settings, key): | |
if key != 'engines-order': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
# swap.sh: Shows the swap usage of each process | |
# Author: Robert Love | |
# source: http://www.quora.com/How-can-you-determine-what-processes-are-using-swap-space | |
swap_total=0 | |
for i in /proc/[0-9]*; do | |
pid=$(echo $i | sed -e 's/\/proc\///g') | |
swap_pid=$(cat /proc/$pid/smaps | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convertion = [ | |
(1024 ** 5, 'P'), | |
(1024 ** 4, 'T'), | |
(1024 ** 3, 'G'), | |
(1024 ** 2, 'M'), | |
(1024 ** 1, 'K'), | |
(1024 ** 0, 'B'), | |
] | |
def size_suffix(bytes): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Simple wrapper for sshuttle :) | |
# | |
# Felipe Reyes <freyes@tty.cl> | |
# | |
PIDFILE=$HOME/.fake-vpn.pid | |
if [ ! -n "$FAKEVPN_HOST" ]; then | |
echo "Please define FAKEVPN_HOST environment variable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this in ~/.bashrc | |
test -f ~/.ssh/agent && source ~/.ssh/agent > /dev/null | |
if [ "x$SSH_AGENT_PID" != "x" ]; then | |
kill -0 $SSH_AGENT_PID || ssh-agent -s -a $HOME/.ssh/agent.socket > ~/.ssh/agent | |
else | |
ssh-agent -s -a $HOME/.ssh/agent.socket > ~/.ssh/agent | |
fi | |
source ~/.ssh/agent > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# Dependencies: | |
# sudo apt-get install libxml-xpath-perl libsys-virt-perl | |
use strict; | |
use XML::XPath; | |
use XML::XPath::XMLParser; | |
use Sys::Virt; | |
# Open libvirt connection and get the domain. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
juju run --service percona-cluster "unit-get private-address" | |
juju run --service percona-cluster "relation-ids cluster" | |
RID=$(juju run --unit percona-cluster/0 "relation-ids cluster") |
OlderNewer