Skip to content

Instantly share code, notes, and snippets.

View skamithi's full-sized avatar

Stanley Karunditu skamithi

  • Raleigh, North Carolina
View GitHub Profile
@skamithi
skamithi / nslcd.conf
Created December 22, 2014 18:37
nslcd.conf confguration for Cumulus Linux KB on LDAP Authentication.
# /etc/nslcd.conf
# nslcd configuration file. See nslcd.conf(5)
# for details.
# The user and group nslcd should run as.
uid nslcd
gid nslcd
# The location at which the LDAP server(s) should be reachable.
uri ldaps://myadserver.rtp.example.test
@skamithi
skamithi / install_new_vm_on_laptop.md
Created December 11, 2014 19:05
installing a new VM on my laptop_using libvirt
# virt-builder ubuntu-14.04 --size 5G --hostname cacti --root-password password:<mypassword> --format qcow2 -o cacti.qcow2

# virt-install --import --name cacti --ram 1024 --disk $HOME/imgs/cacti.qcow2,format=qcow2,bus=virtio,cache=none --os-type linux --os-variant ubuntutrusty
@skamithi
skamithi / virsh_win7.md
Last active August 29, 2015 14:10
virsh + win7
@skamithi
skamithi / npm_cheatsheet.md
Last active August 29, 2015 14:06
npm cheatsheet

Update packages versions in package.json

npm update --save

Install a new package into dependencies

npm install [pkgname] --save

@skamithi
skamithi / create_vm_on_ubuntu_14_04.txt
Created September 6, 2014 19:22
creating vms using virt-builder and virt-install on ubuntu 14.04
! add current user to kvm group
usermod -a -G kvm skamithi
! create root password file
cat 'mypass' > /tmp/rootpw
! update soon with run-command to run 'dpkg-reconfigure openssh-server' to regenerate ssh keys
! without this you get a ssh reset peer message
virt-builder ubuntu-14.04 --root-password file:/tmp/rootpw -o ubuntu1404.qcow2 --format qcow2 --size 10G --hostname ubuntu1404
@skamithi
skamithi / mock_some_func_in_class.py
Created July 17, 2014 18:19
Python - Mock some of the functions in a class while keep the rest the same
@mock.patch('clshow.cliface.CumulusIface.print_name')
@mock.patch('clshow.cliface.CumulusIface.print_ip_details')
@mock.patch('clshow.cliface.CumulusIface.print_counters')
@mock.patch('clshow.cliface.CumulusIface.print_lldp_info')
@mock.patch('clshow.cliface.CumulusIface.print_arp')
def test_print_l3_access(self,
mock_arp,
mock_lldp,
mock_counters,
mock_ip,
@skamithi
skamithi / convert2range.py
Last active August 29, 2015 14:01
python convert list of numbers into ranges.
import re
from itertools import groupby
from collections import OrderedDict
# define list of interfaces
a = ['swp2100', 'bond12.100', 'swp22', 'br20',
'bond0', 'bond22', 'port-channel5']
b = OrderedDict()
# group ports based on int name before digit
@skamithi
skamithi / merge.py
Created May 7, 2014 01:05
Python Merge simple dictionaries
def dict_merge(list1, list2):
""" Trick is to use the .__dict__ keyword. This puts all the attrs associated with
this library's instance are part of the mergin algorithm
_keys = list2.keys()
try _key in keys:
try:
list1[key].__dict__.update(list2[__key].__dict__)
except:
list[_key] = list2[_key]
@skamithi
skamithi / create-ansible-playbook-template.sh
Created April 23, 2014 01:59
script to create ansible playbook structure
#!/bin/bash
# Script to create ansible playbook directories
# define your roles here
roles=(upgrade packages)
directories=(tasks handlers files default vars templates)
# create playbook
mkdir global_vars
@skamithi
skamithi / converting_from_virtualbox_to_kvm.md
Last active July 26, 2025 00:47
Windows7 Libvirt xml.

converted Virtualbox Win7 VM to KVM. (KVM on Ubuntu 14.04)

  • Shutdown Virtualbox VM.

  • Convert the vdi to a raw disk images. Note: vdi are compressed and raw images are not and so you will need to leave enough disk space for entire uncompressed disk.

VBoxManage clonehd --format RAW win7.vdi win7.img
  • Then on your KVM host: