Skip to content

Instantly share code, notes, and snippets.

View praveenkumar's full-sized avatar
🏠
Working from home

Praveen Kumar praveenkumar

🏠
Working from home
View GitHub Profile
@praveenkumar
praveenkumar / vagrant_as_spawn.py
Created August 31, 2016 12:02
Vagrant using pexpect
import pexpect
import sys, getpass
user_pass = getpass.getpass("Sudo password: ")
child = pexpect.spawn('vagrant up --no-provision --provider virtualbox', timeout=120)
i = child.expect([pexpect.TIMEOUT, 'password for .*: '])
if i == 0:
print ('Error')
print(child.before, child.after)
sys.exit(1)
@praveenkumar
praveenkumar / dgplug_sep.py
Created July 21, 2016 06:52
Log separater script for dgplug
#!/usr/bin/env python3
from dateutil import parser
def get_logs(fh, log_file):
for line in fh:
if "endclass" in line:
return fh
else:
with open(log_file, 'w') as fh:
@praveenkumar
praveenkumar / squid.conf
Created June 13, 2016 09:14
squid proxy file (/etc/squid/squid.conf)
#
# Recommended minimum configuration:
#
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
# Auth
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/squid_passwd
#!/bin/bash
#
# virt-install-cloud.sh : script to start an OpenStack cloud image on kvm
# version : 1.0
#
# Author : Claude Durocher
# License : GPLv3
#
# ref. http://mojodna.net/2014/05/14/kvm-libvirt-and-ubuntu-14-04.html
#
@praveenkumar
praveenkumar / tmux-cheatsheet.markdown
Created April 21, 2016 12:56 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@praveenkumar
praveenkumar / vagrant_run.py
Last active December 8, 2015 10:47
Vagrant regression testing for adb/cdk
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright © 2015 Praveen Kumar <[email protected]>
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2, or (at your option) any later
# version. This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY expressed or implied, including the
# Using downloaded Vagrant
vagrant box add cdk2 file:///home/prkumar/work/cdk2/rhel-7.2-server-kubernetes-vagrant-scratch-1-1.x86_64.vagrant-libvirt.box
# Initialize a box (This will create a vagrantfile in current working directory)
vagrant init cdk2
# Start a box
vagrant up
# ssh to the box
@praveenkumar
praveenkumar / pull_latest_image.py
Created October 26, 2015 05:58
Pull all <images>:<tag> with latest build
#!/usr/bin/env python
# Script to get pull all <images>:<tag> with latest build
import docker
import json
cli = docker.Client(base_url='unix://var/run/docker.sock')
repo_tags = []
@praveenkumar
praveenkumar / gist:2b54d9351b41f1ecd7fa
Last active October 23, 2015 14:06
Openshift Experiment
Running Openshift in adb virtual-box
------------------------------------
1. Note adb virtual box already running etcd service which using port
7001 then stop those service (In my case, kubernetes/etcd service was
running and due to that openshift/origin container was not able to run)
BZ #1271468
2. Start openshift origin container
```
import signal
import time
import os
from subprocess import check_output, Popen, CalledProcessError
def get_pid(name):
return check_output(["pidof",name])
def handler(signum, frame):
print "signal handler called with signal %s" % signum