Skip to content

Instantly share code, notes, and snippets.

Vish (Ishaya) Abrams vishvananda

Block or report user

Report or block vishvananda

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vishvananda
vishvananda / vim
Created Feb 5, 2013
script for starting conole vim in homebrew with the Valloric/YouCompleteMe plugin . Put this in your path, for example as /usr/local/bin/vim
View 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 May 22, 2017
Script for setting an encrypted password on boot
View getpass.sh
#!/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`
View gist:3814291
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
View gist:3769012
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 Sep 18, 2012
Logging config for nova using a pipe or special syslog
View logging.conf
[loggers]
keys = root
[handlers]
keys = file, nova_syslog
[formatters]
keys = legacynova
[logger_root]
View gist:3669055
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
View gist:3587563
apt-get update
apt-get install -y linux-headers-virtual
apt-get install -y openvswitch-datapath-dkms
apt-get install -y openvswitch-switch openvswitch-controller openvswitch-brcompat
/etc/init.d/openvswitch-switch start
ovs-vsctl add-br br0
sudo ovs-vsctl add-port br0 gre0 -- set interface gre0 type=gre options:remote_ip=10.8.0.3
sudo ovs-vsctl add-port br0 gre1 -- set interface gre1 type=gre options:remote_ip=10.8.0.5
ovs-vsctl add-port br0 test -- set interface test type=internal
ifconfig test 172.24.16.1/24 up
@vishvananda
vishvananda / translator.py
Created Aug 11, 2012
Translator to translate a python program into an equivalent program with a very limited set of characters
View translator.py
import os
with open('in.py') as infile:
data = infile.read()
def encode(char, sym):
return'+'.join([sym] * ord(char))
def write(outfile, wrap, boc, eoc, sep, sym='1'):
text = sep.join([boc + encode(char, sym) + eoc for char in data])
View gist:3188626
diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py
index e55b54f..c733045 100644
--- a/nova/virt/disk/api.py
+++ b/nova/virt/disk/api.py
@@ -294,7 +294,7 @@ def setup_container(image, container_dir=None, use_cow=False):
raise exception.NovaException(img.errors)
-def destroy_container(img):
+def destroy_container(image, container_dir=None, use_cow=False):
View gist:3080062
# Note, make sure to run nova-manage db sync first to create a sqlite database
from nova import db
from nova.db.sqlalchemy import models
from nova.db.sqlalchemy import session as sess
from nova import context
from sqlalchemy.orm import joinedload
def instance_get_joined(uuid, session):
with session.begin():
val = session.query(models.Instance).filter_by(deleted=False).options(joinedload('instance_type')).filter_by(uuid=uuid).first()
You can’t perform that action at this time.