Skip to content

Instantly share code, notes, and snippets.

View murarisumit's full-sized avatar
🎩
Welcome here

Sumit Murari murarisumit

🎩
Welcome here
View GitHub Profile
@murarisumit
murarisumit / get_loadbalancer_pointing_to_instance.py
Created April 7, 2015 21:46
Boto AWS get loadbalancer pointing to a instance
import boto
import boto.ec2.elb
import boto.ec2.elb.instancestate
elb_conn=boto.ec2.elb.ELBConnection(aws_access_key, aws_access_secret)
lbs=elb_conn.get_all_load_balancers()
for lb in lbs:
for instance_info in lb.instances:
if instance_info.id == "Your_Instance_ID"
@murarisumit
murarisumit / boto_get_all_running_instance_withIPaddr.py
Last active August 29, 2015 14:18 — forked from lavie/ec2hosts.py
Get only running instance from a region and their IP Address
from boto.ec2 import *
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("access_key", help = "AWS Access Key")
parser.add_argument("secret_key", help = "AWS Secret Key")
parser.add_argument("--region", help = "AWS Region", default = "us-east-1")
parser.add_argument("--all", help = "show not just running instances", action = "store_true")
args = parser.parse_args()
@murarisumit
murarisumit / resetPasswordJenkins.txt
Last active August 29, 2015 14:20 — forked from gmhawash/gist:4043232
Reset password for jenkins
0. SSH to server
1. Edit jenkins_home/config.xml
2. set userSecurity to false: <userSecurity>false</userSecurity>
3. delete
<authorizationStrategy> and <securityRealm>
4. /etc/init.d/bitnami restart
@murarisumit
murarisumit / margin vs Padding.md
Last active August 29, 2015 14:21
Margin vs Padding in CSS

Consider two elements next to each other each with padding of 1em. This padding is considered to be part of the element, and is always preserved. So you will end up with the content of the first element, followed by the padding of the first element, followed by the padding of the second. followed by the content of the second element. Thus content of the two elements will end up being 2em apart.

Now replace that padding with 1em margin. Margins are considered to be outside of the element, and margins of adjacent items will overlap. So in this example you will end up with the content of the first element followed by 1em of combined margin followed by the content of the second element. So the content of the two elements is only 1em apart. This can be really useful when you know that you want say 1em of spacing around an element, regardless of what element it is next to. The other two big differences is that padding is included in the click region and background color/image, but not the margin.

**Margins a

@murarisumit
murarisumit / ChangeRootPasswordMySql.md
Last active August 29, 2015 14:21
Change root password for MySQL/MariaDB debian/ubuntu

Set / change / reset the MySQL root password on Ubuntu Linux. Enter the following lines in your terminal.

  1. Stop the MySQL Server.

    sudo /etc/init.d/mysql stop

  2. Start the mysqld configuration.

    sudo mysqld --skip-grant-tables &

@murarisumit
murarisumit / deleteAMIAfterSpecificDate.py
Created May 19, 2015 04:38
AWS boto delete AMI after specific Days.
import boto
import boto.ec2
import sys
import time
import os
import datetime
from datetime import date
#Filter used to filter my instances
vEnvironment = "Prod"
@murarisumit
murarisumit / IIS_updateResponseHeader.ps1
Created May 28, 2015 05:18
IIS Update Reponse header via command-line
#To update the value of response header in IIS
#
appcmd.exe set config /section:httpProtocol /customHeaders.[name=$name].value:$value
@murarisumit
murarisumit / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@murarisumit
murarisumit / searchReplace.vim
Created June 3, 2015 05:49
Search and replace in Vim
Find for sting in vim
/searchString
"press n for cursor on next occurence of string
"Press N to move cursor on previous occurence of string
==================================
@murarisumit
murarisumit / deleteOrphanSnapshots.py
Created June 6, 2015 01:03
Delete Orphan snapshots
snapshots = conn.get_all_snapshots(owner="self") #Fetch only my snapshot
volumes = conn.get_all_volumes()
for snapshot in snapshots:
volume_id = snapshot.volume_id
presence = False
temp = volumes
for volume in temp:
print ".",
if volume_id == volume.id: