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 / remoteExcutePoweshell
Created March 5, 2015 20:11
Remotely execute powershell script
#Script that will be invoked when invoke-command will be executed
$script = [scriptblock]::create("get-host
hostname")
$node = "1.12.3.4"
#UserName that will deploy it
$username = "username"
$pw = "password"
@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 / aws_powershell_get_all_instance_private_IP.ps1
Created April 6, 2015 03:50
AWS powershell get all instance private IP
$instances = (Get-ec2instance -region us-east-1 ).Instances
$servers = @()
foreach( $instance in $instances) {
$ipAddrs+=$instance.PrivateIpAddress
}
foreach ($ip in $ipAddrs) {
write-host $ip
}
@murarisumit
murarisumit / boto_get_all_running_instance.py
Last active August 31, 2015 07:41
Boto fetch all running instance
from pprint import pprint
from boto import ec2
def main():
ec2conn=ec2.connect_to_region('us-east-1')
reservations=ec2conn.get_all_instances(filters={"tag:tag_name": "value",'instance-state-name' : 'running'}})
output=[]
for reservation in reservations: