This file contains hidden or 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 | |
python -m SimpleHTTPServer |
This file contains hidden or 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
from quantumclient.v2_0.client import Client | |
def get_vip_from_fixed_ip(fixed_ip): | |
client = Client( | |
username = app.config['USERNAME'], | |
password = app.config['PASSWORD'], | |
tenant_name = app.config['TENANT_NAME'], | |
auth_url = app.config['AUTH_URL'] | |
) | |
members = client.list_members(address = fixed_ip)['members'] |
This file contains hidden or 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 | |
# Get current swap usage for all running processes | |
# | |
SUM=0 | |
OVERALL=0 | |
for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do | |
PID=`echo $DIR | cut -d / -f 3` | |
PROGNAME=`ps -p $PID -o comm --no-headers` |
This file contains hidden or 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/sh | |
sync; echo 3 > /proc/sys/vm/drop_caches |
This file contains hidden or 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 | |
for device in `ovs-vsctl list-ports br-int | grep ^qvo`; do | |
dev=${device:3} | |
echo $device | |
prop=`ovs-vsctl -- --columns=external_ids list Interface ${device}` | |
mac=`echo "$prop" | sed 's/.*attached-mac="\([a-z0-9:]*\).*/\1/g'` | |
iface_id=`echo "$prop" | sed 's/.*iface-id="\([a-z0-9-]*\).*/\1/g'` | |
iface_status=`echo "$prop" | sed 's/.*iface-status=\([a-z]*\).*/\1/g'` |
This file contains hidden or 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: gs.sh git checkout master | |
cwd=`pwd` | |
for repo in `find . -name .git`; do | |
repo=${repo/.git} | |
cd $cwd/$repo | |
echo "==== $repo ====" | |
This file contains hidden or 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/sh | |
genpasswd() { | |
local l=$1 | |
[ "$l" == "" ] && l=16 | |
cat /dev/urandom | LC_CTYPE=C tr -dc A-Za-z0-9_ | head -c ${l} | |
echo | |
} | |
genpasswd "$@" |
This file contains hidden or 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: | |
# git clone https://gist.github.com/ea78bb56d5bd901187dc.git docker.gist | |
# mkdir ~/bin | |
# ln -s docker.gist/docker.sh ~/bin/docker | |
# export PATH=$PATH:~/bin | |
/usr/local/bin/docker "$@" | |
r=$? | |
update_boot2docker_ip() { |
This file contains hidden or 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
package main | |
import ( | |
"errors" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"os" | |
"time" |
This file contains hidden or 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
import os | |
import keystoneclient.v2_0.client as kclient | |
from neutronclient.v2_0 import client as neutronclient | |
def basic_auth(): | |
keystone = kclient.Client( | |
auth_url = os.environ.get('OS_AUTH_URL'), | |
username = os.environ.get('OS_USERNAME'), | |
tenant_name = os.environ.get('OS_TENANT_NAME'), |