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 / addRecordRoute53.py
Last active September 3, 2015 06:10
Adding record to route53.
import boto
import sys, traceback
r53conn = boto.connect_route53(aws_access_key_id="xxxxxxxxxxxxxx",aws_secret_access_key="yyyyyyyyyy")
recordSets = r53conn.get_zone("yourdomain.in")
try:
recordSets.add_cname(rSet[0],rSet[1])
except Exception, e:
print "======"
print rSet[0] + " wasn't added to route53"
@murarisumit
murarisumit / getDNSEntryRoute53.py
Last active September 11, 2018 08:14
Get DNS Entry route53 #boto #aws
import boto
r53conn = boto.connect_route53(aws_access_key_id="xxxxxxxxxxxxxx",aws_secret_access_key="yyyyyyyyyy")
recordSets = r53conn.get_zone("yourdomain.in")
#Sorry for the hacky way.....!
for recordset in recordSets.get_records():
print recordset.name + " : " + recordset.to_print()
@murarisumit
murarisumit / checkIfDNSRecordExist.py
Last active November 17, 2020 00:06
Check if DNS record exist in route53 #boto #aws #route53
def checkifDnsRecordExist(domain_name,dns_record):
'''
(str, str) --> (str)
Read your domain-name and dns_record and check if it exists or not
Returns recordSet and it's value in return
#If record exist
>>> checkifDnsRecordExist("domain_name.com", "mail.domain_name.com")
mail.domain_name.com : 5.3.5.3
@murarisumit
murarisumit / persistBrightnessSetting.md
Created July 16, 2015 13:59
Save backlight level at startup #ubuntu #debian

##Here we'll set the brightness level at startup Use xbacklight utility.

  1. In debian/ubuntu find startup applications portal
  2. Add command xbacklight -set 30
@murarisumit
murarisumit / parse_xml_in_python.md
Last active September 14, 2015 17:12
Parsing XML in python #xml #python #parsing
  1. Using elementtree for that...

In order to install it: pip.exe install elementtree --allow-unverified elementtree ( i don't why --allow-unverified elementtree)

example :

@murarisumit
murarisumit / launch_command_line_program_from_overview.md
Last active August 29, 2015 14:27
Launch your command line application from overview/system-menu gnome #debian #gnome #startup

Inorder to list your application in overview.

  1. Create a .desktop file
  • You can find any file in /usr/share/applications
  • Open and modify it's attribute
  1. Place this file in the /usr/share/applications directory so that it is accessible by everyone, or ~/.local/share/applications if you only wish to make it accessible to a single user. Which is used should depend on whether your application is installed systemwide or into a user's home directory.

Reference: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en

@murarisumit
murarisumit / volume_to_drive_letter_mapping.ps1
Created August 11, 2015 05:56
AWS Windows volume_to_drive_letter_mapping #windows #powershell
# List the Windows disks
# Create a hash table that maps each device to a SCSI target
$Map = @{"0" = '/dev/sda1'}
for($x = 1; $x -le 26; $x++) {$Map.add($x.ToString(), [String]::Format("xvd{0}",[char](97 + $x)))}
for($x = 78; $x -le 102; $x++) {$Map.add($x.ToString(), [String]::Format("xvdc{0}",[char](19 + $x)))}
Try {
# Use the metadata service to discover which instance the script is running on
$InstanceId = (Invoke-WebRequest '169.254.169.254/latest/meta-data/instance-id').Content
@murarisumit
murarisumit / check_for_instance_protection.py
Last active June 26, 2019 16:30
Check for instance without termination protection #aws #boto #python #ec2
import boto
import sys, traceback
import os
print "=== Instance without terminate protection=============="
conn = boto.connect_ec2(aws_access_key_id='<aws access key>',aws_secret_access_key='<aws secret key>')
instances = conn.get_only_instances()
for instance in instances:
attrib = instance.get_attribute("disableApiTermination")
@murarisumit
murarisumit / find_iam_user.py
Last active August 29, 2015 14:28 — forked from OnlyInAmerica/find_iam_user.py
Find an AWS IAM user corresponding to an AWS Access Key
# Find the IAM username belonging to the TARGET_ACCESS_KEY
# Useful for finding IAM user corresponding to a compromised AWS credential
# Requirements:
#
# Environmental variables:
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
# python:
# boto
@murarisumit
murarisumit / vim-notes.md
Last active September 1, 2015 12:31 — forked from JeffPaine/vim-notes.md
General vim notes.

Vim Notes

  • set list Shows invisible characters.
  • set listchars What invisibile characters should be set to, see :h listchars for complete list.

Key Remapping

  • map creates a key map that works in normal, visual, select and operator pending modes
  • map! creates a key map that works in insert and command-line mode.