Skip to content

Instantly share code, notes, and snippets.

View rammanokar's full-sized avatar

SSR rammanokar

View GitHub Profile
@rammanokar
rammanokar / boto3-list-instances.py
Created January 3, 2019 07:17 — forked from ableasdale/boto3-list-instances.py
Using Boto 3 to list out AWS EC2 instance information
import boto3
from termcolor import colored
ec2 = boto3.resource('ec2')
for i in ec2.instances.all():
print("Id: {0}\tState: {1}\tLaunched: {2}\tRoot Device Name: {3}".format(
colored(i.id, 'cyan'),
colored(i.state['Name'], 'green'),
@rammanokar
rammanokar / gist:47404603887173943507a097d34a5c0f
Last active November 28, 2019 08:20
Script to resize a LVM Partition after extending the underlying disk device.
#!/bin/bash
##########
# Script to resize a LVM Partition after extending the underlying disk device. Can be used on physical or virtual machines alike.
# Tested with CentOS6, RHEL6, CentOS7, RHEL7. This script is only intended for MBR partitioned disks and not for GPT.
#
# The script will first resize the partition by changing the partition end sector of the selected partition, and then after a reboot resize the filesystem.
# By default it rescans the SCSI bus to check a change in disk size if the disk was hot-extended, which is easy with VMs, and only then proceeds.
# If the extended disk size is recognized by the OS already, you can force resizing with the -f flag.
#
# It is recommended you backup the boot sector of your disk before as a safety measure with something like the following:
@rammanokar
rammanokar / README.md
Created October 1, 2019 08:22 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@rammanokar
rammanokar / ansible-summary.md
Created October 18, 2019 06:22 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@rammanokar
rammanokar / Deploy-xen.yml
Created October 22, 2019 03:13
Deploay Xen server using ansible
Machines:
Connectors:
- hostname: CCConn-0001
num_cpus: 4
num_cpu_cores_per_socket: 2
memory_mb: 8192
- hostname: CCConn-0002
num_cpus: 4
num_cpu_cores_per_socket: 2
memory_mb: 8192
@rammanokar
rammanokar / lb-check.sh
Created November 28, 2019 08:14
Bash script to check Loadbalancer scheduling
#!/bin/bash
server1=0
server2=0
for i in {1..10}
do
lsb=$(wget -qO - https://x.x.x.x/server.text --no-check-certificate --no-cookies)
# server.text hold different value for different server
if [ $lsb == "server-1" ]
then
let "server1++"
@rammanokar
rammanokar / server.conf
Created December 10, 2019 06:09 — forked from laurenorsini/server.conf
OpenVPN configuration for /etc/openvpn/server.conf
local 192.168.2.0 # SWAP THIS NUMBER WITH YOUR RASPBERRY PI IP ADDRESS
dev tun
proto udp #Some people prefer to use tcp. Don't change it if you don't know.
port 1194
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/Server.crt # SWAP WITH YOUR CRT NAME
key /etc/openvpn/easy-rsa/keys/Server.key # SWAP WITH YOUR KEY NAME
dh /etc/openvpn/easy-rsa/keys/dh1024.pem # If you changed to 2048, change that here!
server 10.8.0.0 255.255.255.0
# server and remote endpoints
@rammanokar
rammanokar / update_terraform.sh
Last active April 20, 2020 12:53
Automatic update Terraform
#!/usr/bin/env bash
#Defining Terrafrom Directory
INSTALL_DIR="/opt/terraform"
#Terrafrom URL
URL="https://releases.hashicorp.com/terraform"
#Getting local version
LOCAL_VER="0"
if [ -x "$(command -v terraform)" ]; then
LOCAL_VER=$(terraform -version | grep -v "+" | awk -Fv '{print $2}')
fi
@rammanokar
rammanokar / bulk_rename.ps
Created December 27, 2019 11:38
Bulk renaming windows powershell
Get-ChildItem C:/temp/ -Recurse -Filter *Goop* | Rename-Item -NewName { $_.name -replace 'Goop', 'gooey2'} -verbose
#!/usr/bin/env bash
#usage:
# rsync_folder_with_retry_sleep.sh /usr/hdp /data/usr/
#/usr/hdp folder will be synced to /data/usr/hdp
src=$1
dest=$2
RC=1
while [[ $RC -ne 0 ]]