March 15, 2017

How to upload files to S3 using Python Boto3?

The below script gives you a quick example of uploading a specific file to the S3 bucket, provided the IAM user calling the API has the s3:GetObject permissions on the S3 bucket.

# Boto3 script to upload a file to S3
import boto3
session = boto3.Session(profile_name='<profilename>') #ensure to use appropriate  profile
s3_client = session.client('s3')

print "Upload the your test file to S3"
s3_client.upload_file('<file path>/<file name with extension>', '<s3 bucket name>', '<prefixfolder/filename with extension>)

print "Success! Upload complete"
print "Getting list"
files=s3_client.list_objects(Bucket='<s3 bucket name>', Prefix='<prefixfolder/filename with extension>')['Contents']

for key in files:

   print key

December 27, 2016

Guest Lecture on `Industry Awareness` @ BIT Sathy

It is the time of the year again to visit my Alma Mater to address the highly energetic and enthusiastic final year Engineering students from Computer Science department upon the invite from our revered head of the department, Dr. Thangaraj.

The lecture was on Industry Awareness covering 3 major aspects to prepare the budding engineers for the onward journey when they set their foot loose from the compassionate college life to the competitive corporate world.

1. What does the Industry Expect from the emerging Engineers?
2. The other side of the coin for the Engineers. 
3. When do you quench your Entrepreneurial thirst? 

Followed by much involved students interaction and all is to inspire our juniors to dream more, to learn more and to do more in-turn to the society.


Guest Lecture @ BIT Sathy

Refer the link to certificate of appreciation  from the college for the Guest Lecture.

December 1, 2014

Gradle script to list xml files recursively from specified directory

In the previous article, we saw how to list xml files recursively from the specified directory using Ant Script.

Here is the code snippet to do the same in Gradle script.

import groovy.io.FileType

// defining defaulttasks
defaultTasks 'listfile'

task listfile ()<< {
// user defined property - srcdir
ext.srcdir = "D:\Src"
println ' '
}
listfile.doFirst {
    print '-----------------------------------------'
}

listfile << {
def list = []
def dir = new File(listfile.srcdir)
dir.eachFileRecurse (FileType.FILES) { file ->
  if(file.name.endsWith('.xml')) {
    list << file
}
}
println 'List of xml files: \n-----------------------------------------'
list.each {
  println it.path
}
 println '-----------------------------------------'
}

November 30, 2014

Ant Script to list xml files recursively from specified directory

Here is the code-snippet to list the files recursively in the specified directory using <foreach>, <path> &  <fileset>

<project name="ListFilesProject" default="listfiles" basedir=".">
    <description>
           List Files recursively
    </description>
  <!-- set global properties for this build -->
  <property name="src.dir" value="D:\src" />
 
  <target name="listfiles" description="list the files" >
   <echo message="listfiles xml files in the given directory"/>
   <taskdef resource="net/sf/antcontrib/antlib.xml"/>
   <foreach target="list_xml_file" param="xml_File" >
         <path>
             <fileset dir="${src.dir}" casesensitive="yes" includes="**/*.xml" />
         </path>
    </foreach>
  </target>
 
  <target name="list_xml_file">
          <echo message="${xml_File}"/>
  </target>
 
</project


Note:

Usage of <foreach> requires ant-contrib-1.0b2.jar. Download it from http://mirrors.ibiblio.org/maven/ant-contrib/jars/ant-contrib-1.0b2.jar place it under <Ant Installation Dir>\ant\lib

*.xml       ->  lists all the xml files from the specified directory
**/*.xml  - > lists all the xml files from all the sub-directories under specified directory

The * matches all files in the directory while ** matches the all the files in the entire directory tree.

November 9, 2014

BIT Alumnae Grand Reunion @ Bangalore

BIT started taking initiatives to inaugurate Alumnae chapter in different cities to lay a platform for fellow Alumnae to network and I am glad to be nominated as a Secretory for Bangalore Chapter.
Here is the picture from Bangalore Chapter Inauguration and also spoke on my experience from College to Corporate along with our responsibilities of  giving back to the family, environment, society & college.

Proud to be a BITian! and this is my first non-techical lecture :) 




The central theme of the talk:


“Return Gift”
Parents with school going kids might be familiar with the term and how do we relate that to ourselves..
We are indebted to many people in our life like our family members, our college, mother earth, society etc. on various grounds. By all means we continue to support our family but now it’s our turn to pause, turn back and see, how we can pay back. 
1.       Giving back to the earth:
Let’s preserve the natural resources for our own kith n kin and set an example for our next generation. This will imbibe the principals of conservation to our kids.

2.       Giving back to the society:
We can certainly associate ourselves with one of the trust worthy NGOs to lend a helping hand to the needy.
Two of the BIT Alumni – 1st batch textile students – Murugesh & Rajkumar have formed a group named SWASAM in the year April 2009 with our college mates and their colleagues contributing only 100/- per month and these two persons have been instrumental in routing that money to couple of ashrams in Avinashi, Coimbatore & Pollachi. Now there are 177 members in the group and in the past 6 years, these two people have never missed or delayed to send even a single monthly report. That’s the power of the Alumni & the power of networking. 
So it doesn’t mean that some of you should coin an impressive name like SWASAM and start collecting moneyJ. It is just an example and there are ‘n’ no. of ways to give back to the society.

3.       Giving back to the college:
I personally feel there is a Void in the path from College to Corporate i.e. the transition of a student to an employee or an entrepreneur. Alumni can play a vital Role to mend the gap
·         Emphasising the value of Communication & Presentation Skills, creating an awareness on corporate Etiquette etc. 
College authorities have been doing this but when we talk, the impact & influence will be manifold.
·         We can be a mentor for a student
·         And even committing yourselves for a “Guest Lecture”.
For various reasons, you may not be able to travel down to the college but the technology advancements like video conferencing can tie the knot to mend the gap.

I would like to end with a note from The Alchemist by Paulo Coelho "When you wanted to achieve something, the whole world conspires to help you achieve the same".

Wish you all a very great success in life.


Recordinghttps://www.youtube.com/watch?v=kgUrYYqc59o from 16th to 25th minute.