Skip to content

Instantly share code, notes, and snippets.

View amalgjose's full-sized avatar
🎯
Focusing

Amal G Jose amalgjose

🎯
Focusing
View GitHub Profile
@amalgjose
amalgjose / GetDistance.py
Created March 22, 2015 04:44
Python program to find the distance between two gps locations
__author__ = 'Amal G Jose'
from math import radians, cos, sin, asin, sqrt
def get_distance(lon1, lat1, lon2, lat2):
##convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
##haversine formula
dlon = lon2 - lon1
@amalgjose
amalgjose / ChangeBucketPermissions.py
Last active August 29, 2015 14:18
This code is for changing the permission of all the files in an amazon S3 bucket. This program will add read permissions to all the files present in the specified S3 bucket.
class ChangeBucketPermissions(object):
##Initializer
def __init__(self):
self.aws_access_key = "XXXXXXXX"
self.aws_secret_key = "XXXXXXXX"
aws_region = 'us-east-1'
self.s3_conn = boto.connect_s3(aws_access_key_id=self.aws_access_key,
aws_secret_access_key=self.aws_secret_key,
calling_format=boto.s3.connection.OrdinaryCallingFormat()))
@amalgjose
amalgjose / SimpleDataUploader.py
Created April 23, 2015 11:12
Python program for sending a file to S3
__author__ = 'Amal G Jose'
import boto
import ntpath
from boto.s3.connection import S3Connection
class SimpleDataUploader(object):
##Initializer
def __init__(self):
@amalgjose
amalgjose / CarDetails
Last active August 29, 2015 14:19
This file contains the sample data set for Elasticsearch
{
"carName": "Dzire",
"manufacturer": "Maruthi",
"type": "sedan"
}
{
"carName": "WagonR",
"manufacturer": "Maruthi",
"type": "mini"
@amalgjose
amalgjose / systeminfo.sh
Created July 4, 2015 14:29
Shell Script to get the consolidated details of a linux system
#!/usr/bin/env bash
# Author Amal G Jose
# This script provides the consolidated details of a linux operaing system
# clear the screen
clear
# Unset Variables
unset sys_date tempvar os architecture kernelrelease internalip externalip nameserver loadaverage sysuptime
@amalgjose
amalgjose / SendEmail.py
Last active August 29, 2015 14:25
A simple python webservice using tornado. Email notification will be send for reach request.
__author__ = 'Amal G Jose'
import smtplib
class SendEmail(object):
def __init__(self):
self.email_id = "sender@gmail.com"
self.email_password = "password"
@amalgjose
amalgjose / hadoop-conf
Last active August 29, 2015 14:26
hadoop-conf-sample
sudo mkdir -p /app/hadoop/tmp
sudo chmod 777 /app/hadoop/tmp
sudo chown hdfs:hadoop /app/hadoop/tmp
<-- IN CORE-SITE.XML -->
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
@amalgjose
amalgjose / TornadoSSL.py
Last active October 30, 2022 20:43
Sample service using python tornado with SSL.
__author__ = 'Amal G Jose'
import os
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
class HelloWorldHandler(tornado.web.RequestHandler):
@amalgjose
amalgjose / GetAWSSummary.py
Last active April 3, 2020 12:45
Program to find get the summary of EMR clusters and EC2 instances running across all regions in an AWS account. This program can be executed via cron to get summary alerts in periodic intervals. An HTML email will be generated and send to the list of recipients mentioned in program. In this program, EMR and EC2 service summary are only considere…
__author__ = 'Amal G Jose'
import sys
import smtplib
import time
import boto
import boto.ses
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
@amalgjose
amalgjose / GetRedShiftDetails.py
Created October 11, 2015 05:45
Program to list all the redshift clusters across all regions.
__author__ = 'Amal G Jose'
import boto
class GetRedShiftDetails(object):
def __init__(self):
self.aws_access_key = "XXXXXXXX"
self.aws_secret_key = "XXXXXXXX"