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 / MoveToLeft
Last active August 29, 2015 14:16
Move windows side by side xfce. Vertically Maximized xfce
#!/bin/bash
# resizes the window to full height and 50% width and moves into upper right corner
#define the height in px of the top system-bar:
TOPMARGIN=27
#sum in px of all horizontal borders:
RIGHTMARGIN=10
# get width of screen and height of screen
@murarisumit
murarisumit / getAllInstance.py
Last active August 29, 2015 14:16
Get all ec2 instance
from pprint import pprint
from boto import ec2
#You need to give access keys and key secret too..
ec2conn=ec2.connect_to_region('us-west-1')
#A reservation corresponds to a command to start instances. You can see what instances are associated with a reservation:
#Here reservation is like group of instance which can be started and stopped instantly as group
reservations=ec2conn.get_all_instances()
for reservation in reservations:
instance=reservation.instances
# from fabric.api import *
# from fabric.colors import green as _green, yellow as _yellow
from boto.ec2.connection import EC2Connection
import time
# def start_machine(ami='ami-d7a18dbe'):
'''Launch a single instance of the provided ami'''
aws_access_key_id = 'Cf7...'
@murarisumit
murarisumit / getAllPrivateIP.py
Created March 6, 2015 06:21
Get private IP address of all the instances in aws
from pprint import pprint
from boto import ec2
ec2conn=ec2.connect_to_region('us-east-1')
reservations=ec2conn.get_all_instances()
for reservation in reservations:
#type is <resultset>, a modified version of python LIST
resultset=reservation.instances
#Get instance object
instance=resultset[0]
@murarisumit
murarisumit / getAllZoneID
Created March 17, 2015 06:37
boto_Route53_get-all-Zone-ID
from boto import route53
import os
r53=route53.connect_to_region(region_name='us-east-1')
all_zones = r53.get_all_hosted_zones()
hosted_zones = all_zones['ListHostedZonesResponse']['HostedZones']
for hosted_zone in hosted_zones:
zone_id = hosted_zone['Id']
print os.path.basename(zone_id)
@murarisumit
murarisumit / .vimperatorrc
Last active August 29, 2015 14:17
My vimperatorrc file
" Map d to nothing, because I accidently press 'd' at-times.
nnoremap d <nop>
" Press 'q' to delete current tab
noremap q :bdelete<CR>
" Move tab left/right(Sometimes I do stupid things)
noremap J :tabmove -1<CR>
@murarisumit
murarisumit / gaukeRemoveAutoRenamingOfTabs.sh
Last active August 29, 2015 14:17
Guake remove autoRenaming of tabs
#Execute this line in command prompt
gconftool-2 --set /apps/guake/general/use_vte_titles --type boolean false
@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