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 / FileMultiplier.sh
Created November 19, 2014 11:33
Shell script for multiplying a file
#!/bin/bash
count=1
limit=10
while [ $count -le $limit ]
do
cat A.txt >> B.txt
cat B.txt >> A.txt
@amalgjose
amalgjose / CreateSnappy
Created November 21, 2014 10:48
Java program to compress a file in snappy. This compressed file can be used in hadoop, because the libraries used in this program are taken from hadoop.
package com.snappy.codec;
/*
* @author : Amal G Jose
*
*/
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@amalgjose
amalgjose / HelloTornado.py
Last active August 29, 2015 14:15
Simple python tornado application
__author__ = 'Amal G Jose'
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
define("port", default=8888, help="run on the user defined port", type=int)
@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 / 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 / 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"
@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