Skip to content

Instantly share code, notes, and snippets.

View vishvananda's full-sized avatar

Vish (Ishaya) Abrams vishvananda

  • Heroku
  • United States
View GitHub Profile
@vishvananda
vishvananda / tunnel.sh
Created October 22, 2013 03:16
Script to set up an ipsec tunnel between two machines For Example: ./tunnel.sh 10.10.10.1 10.10.10.2 192.168.0.1 192.168.0.2 would set up an ipsec tunnel over 10.10.10.1 address using 192.168.0.1 as a virtual address passwordless sudo required for user on remote machine
#!/bin/bash
if [ "$4" == "" ]; then
echo "usage: $0 <local_ip> <remote_ip> <new_local_ip> <new_remote_ip>"
echo "creates an ipsec tunnel between two machines"
exit 1
fi
SRC="$1"; shift
DST="$1"; shift
@vishvananda
vishvananda / strip-deb-key.sh
Created October 3, 2013 18:14
Strip the signing key from a debian package.
#!/usr/bin/env bash
if [ "$1" == "" ]; then
echo "Usage: $0 <deb-package>"
exit 1
fi
TARGET=$1
TMPDIR=`mktemp -d`
dpkg-deb -x $TARGET $TMPDIR
@vishvananda
vishvananda / docker_netns.sh
Last active January 8, 2022 18:21
Expose the netns of a docker container to the host.
#!/usr/bin/env bash
if [ "$1" == "" ]; then
echo "usage: $0 <docker_id>"
echo "Exposes the netns of a docker container to the host"
exit 1
fi
ppid=`docker inspect $1 | grep Pid | awk '{print $2 + 0}'`
if [ "$ppid" == "" ]; then
echo "lxc parent pid not found"
@vishvananda
vishvananda / git.sh
Created May 8, 2013 00:42
show me all commits since we added the debian directory that don't modify the debian directory, aren't cherry-picks (as identified by having the word 'cherry' in the commit message), and aren't merge commits. (The since 2011-01-01 is to ignore really old commits when searching for the debian directory addition since really old commits of nova ha…
git log --no-merges --pretty=oneline `git rev-list HEAD --since "2011-01-01" -- debian | tail -n1`..HEAD | grep -v -F "`git rev-list HEAD -- debian`" | grep -v -F "`git rev-list HEAD --grep cherry`"
@vishvananda
vishvananda / vim
Created February 5, 2013 20:45
script for starting conole vim in homebrew with the Valloric/YouCompleteMe plugin . Put this in your path, for example as /usr/local/bin/vim
#!/bin/bash
DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=/usr/local/Cellar/python/2.7.3/lib/libpython2.7.dylib /usr/local/Cellar/macvim/7.3-*/MacVim.app/Contents/MacOS/Vim "$@"
@vishvananda
vishvananda / getpass.sh
Last active January 8, 2022 18:21
Script for setting an encrypted password on boot
#!/usr/bin/env bash
SSH_KEYFILE=`tempfile`
SSL_KEYFILE=`tempfile`
if ! curl -s -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > $SSH_KEYFILE; then
echo "Failed to get key"
fi
cat $SSH_KEYFILE
PASSWORD=`openssl rand -base64 48 | tr -d '/+' | cut -c1-16`
sudo usermod ubuntu -p `openssl passwd -1 $PASSWORD`
commit 9d5cb9213493160c6df97bd527bd597e648901fa
Author: Vishvananda Ishaya <vishvananda@gmail.com>
Date: Mon Sep 10 21:29:06 2012 -0700
fix nova-novncproxy package and dependencies
Change-Id: Ib5af0fdde528247b4634b5a18933f6eb9f260047
diff --git a/debian/control b/debian/control
index 1f6a702..9748a42 100644
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 42e9e50..0b2d2d5 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -1284,8 +1284,7 @@ class API(base.Base):
m[attr] = val
volume_id = m.get('volume_id')
- snapshot_id = m.get('snapshot_id')
- if snapshot_id and volume_id:
@vishvananda
vishvananda / logging.conf
Created September 18, 2012 01:26
Logging config for nova using a pipe or special syslog
[loggers]
keys = root
[handlers]
keys = file, nova_syslog
[formatters]
keys = legacynova
[logger_root]
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py
index 6f103f6..3f2f908 100644
--- a/nova/tests/integrated/test_api_samples.py
+++ b/nova/tests/integrated/test_api_samples.py
@@ -22,6 +22,7 @@ from nova import flags
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common.log import logging
+from nova.openstack.common import rpc
from nova import test