This page is created in Python and gets data from my Gists

#!/usr/bin/python
import urllib

def get_page(page):
	if(seed != ''):
 	       return urllib.urlopen(page).read()
	else:
		return ''

def get_next_url(page):
	pre_link = page.find('
	      
#!/usr/bin/python
# This program is written without using any built-in functions
# Not using Lists, as a practice for students learning Python
def isLeapYear(year):
	if ((year%4 == 0 and year%100 != 0)) or year%400 == 0:
		return True
	return False

def daysInMonth(year, month):
	if month in {1,3,5,7,8,10,12}:
		days = 31
	if month in {4,6,9,11}:
		days = 30
	if month == 2:
		if isLeapYear(year):
			days = 29
		else:
			days = 28
	return days

def nextDay(year, month, day):
    if day < daysInMonth(year, month):
        return year, month, day + 1
    else:
        if month == 12:
            return year + 1, 1, 1
        else:
            return year, month + 1, 1
        
def dateIsBefore(year1, month1, day1, year2, month2, day2):
    """Returns True if year1-month1-day1 is before
       year2-month2-day2. Otherwise, returns False."""
    if year1 < year2:
        return True
    if year1 == year2:
        if month1 < month2:
            return True
        if month1 == month2:
            return day1 < day2
    return False        

def daysBetweenDates(year1, month1, day1, year2, month2, day2):
    """Returns the number of days between year1/month1/day1
       and year2/month2/day2. Assumes inputs are valid dates
       in Gregorian calendar."""
    # program defensively! Add an assertion if the input is not valid!
    assert not dateIsBefore(year2, month2, day2, year1, month1, day1)
    diff = 0
    while dateIsBefore(year1, month1, day1, year2, month2, day2):
        year1, month1, day1 = nextDay(year1, month1, day1)
        diff += 1
    return diff
print daysBetweenDates(2011,6,30,2012,6,30)
#!/usr/bin/python
import urllib

def get_page(url):
	if(url):
 	       return urllib.urlopen(url).read()
	else:
		return ''

def get_next_url(page):
	pre_link = page.find('
	      
#! /usr/bin/python

import urllib, json

URL = "https://api.github.com/users/rathankalluri/gists" #https://api.github.com/users//gists
response = urllib.urlopen(URL)
data = json.loads(response.read())

for i in range(0,len(data)):
	filename = data[i]['files'].values()[0]['filename']
	
	gisturl = 'https://api.github.com/gists/'+data[i]['id']
	gistdata = json.loads(urllib.urlopen(gisturl).read())
	description =  gistdata['description']
	content =  gistdata['files'][filename]['content']
	print(description)
	print(content)
	print('\n')
#!/bin/sh
#function for my use
makedir()
{      echo -e "Listing all Directories and Files Present Under Home \n========================================"|cat >cr_file_for_test.txt  
	echo -e "\nDirectories\n--------------"|cat >>cr_file_for_test.txt     
	find /home -type d |cat >>cr_file_for_test.txt # I need only the directories in home so 'find @ home only of type d'
	echo -e "\nFiles\n--------"|cat >>cr_file_for_test.txt     
	find /home -type f |cat >>cr_file_for_test.txt 
      echo "File cr_file_for_test.txt created"
             }
# A program to find the directory and create a file in it
 #start
     clear
     echo "Enter the directory name "
     read dname
 #check for a directory
    if [ -d $dname ]
    then
 #if exist
      echo "Directory Found"
      cd $dname
      if [ -e cr_file_for_test.txt ] #if file exists I am removing it 
      then
      rm cr_file_for_test.txt  
      fi      
      echo -n "Creating File "cr_file_for_test.txt" "
      for i in 1 2 3 #for making the user feel that I am actually working !!! :P
      do 
      sleep 1
      echo -n "." 
      done
      makedir #calling function to create file
      exit 0  
   else  
 #if do not exist
      echo "Directory doesn't exist.Want to create one?(y/n)"
      read y
 #Creating a Directory
      if [ $y = 'y' ]
       then
       mkdir $dname
       cd $dname        
       makedir #calling function to create file
       fi
     fi
     exit 0
 #stop
 #! /bin/bash
# This is my very first program in IT industry :D
#This programme is for creating qr codes for the data in the database and storing those codes back into the database.
#Functions used are in the beggining
#
#====================START OF dirfun()..(creates directory)================
#
dirfun()
{ cd /home/rathankalluri/Rathan/
 if [ -d qrcodes ]
  then
  echo "Directory Exists"
  else
  mkdir qrcodes 
  chmod 777 qrcodes
  echo "Dir created "
 fi
}
#
#====================END OF dirfun()==================
#
#=================START OF name_qr_creator()..creates qr codes and its file names==========
#
name_qr_creator()
{
mysql < cat >tempfil
use mysql;
select eno,ename from employee;
EOF
no_ln=$(wc -l tempfil|awk '{ print $1 }')
#"echo The number of lines are $no_ln" This is for testing purpose
count=1
while [ "$count" -le "$no_ln" ] && read line 
do
if [ $count = 1 ]
then
#"echo count is $count"   This is for testing purpose
count=2
else 
#"echo The line is :: $line " This for testing purpose
rawdat=`sed -n "$count"p tempfil`
fnm=`echo $rawdat| sed -e 's/ /_/g'`
#"echo The fil name is $fnm" This is for testing purpose
touch "$fnm".png
chmod 777 $fnm.png
#"echo "The file is @ `pwd`"" For Testing
$(qrencode "$line" -o "$fnm".png)
stat=yes
paths=(`pwd`"/$fnm.png")
#"echo $paths" For Testing 
lp=1
for word in $rawdat
do
if [ $lp = 1 ]
then
e_no=$word
lp=2
fi
done
#"echo $e_no"  For Testing 
mysql -D mysql < cat >Details
use mysql ;
select * from employee ;
M
#"cat Details"  #For Testing the output from Database
echo -e "Initializing the Creation process \n" 
echo -e "Reading row by row details \n" #line to be removed later
echo "Trying to create a directory"
dirfun
cd /home/rathankalluri/Rathan/qrcodes
echo -e "Qr code generator started \n"
   name_qr_creator #Calling QR code creator
echo "Done"
echo -e "removing temporary files \n"
rm -rf /home/rathankalluri/Documents/cat
rm -rf /home/rathankalluri/Documents/Details
echo -e "Killing Connections... please wait \n"
 /etc/init.d/mysqld stop
echo -e "Program Termination Complete !!!!"
exit 0
#
#======================== END OF MAIN PROGRAM ===============================
#
import turtle
""" Draw a flower in Pyhton"""

def draw_square(square):
	for i in range(0,2):
		square.forward(100)
		square.right(30)
		square.forward(100)
		square.right(150)


def draw_flower():
	window = turtle.Screen()
	window.bgcolor("blue")

	pen = turtle.Turtle()
	pen.shape("triangle")
	pen.color("#99FF00")

	for i in range(0,36):
		draw_square(pen)
		pen.right(10)

	for i in range(0,4):
		pen.circle(50)
		pen.right(90)
	pen.right(90)
	pen.forward(300)
	pen.right(90)
	draw_square(pen)
	pen.left(180)
	draw_square(pen)
	pen.left(270)
	pen.forward(200)

	window.exitonclick()

draw_flower()
#!/usr/bin/python

""" The program prints when your age will be hundred """

from datetime import datetime
import sys

def year_when_hundred(current_year, age):
	year = current_year.year + (100 - age)
	return year

user_name = raw_input("Your Name: \n")
try:
	user_age = int(input("Your Age: \n"))
except SyntaxError as e:
	print("That's an error. Try again...")
	sys.exit()
current_year = datetime.now()

year_at_hundered = year_when_hundred(current_year, user_age)
print(user_name + "!! You will be hundred in "+str(year_at_hundered))

RathanKalluri.com - Copyright 2016