Skip to content

Instantly share code, notes, and snippets.

View rathankalluri's full-sized avatar
🎯
Focusing

Ratna Kumar K V V rathankalluri

🎯
Focusing
View GitHub Profile
@rathankalluri
rathankalluri / WhenAmIHundred.py
Last active November 14, 2017 04:41
Find when you are Hundred
#!/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
@rathankalluri
rathankalluri / Flower.py
Created November 1, 2016 07:34
Draw a Flower in Python
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)
@rathankalluri
rathankalluri / QRCode.sh
Created November 4, 2016 09:01
QR Code creator in Shell Programming
#! /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 ]
@rathankalluri
rathankalluri / dirFile.sh
Created November 4, 2016 09:39
Creating Log File in Directory in shell
#!/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"
}
@rathankalluri
rathankalluri / GetGists.py
Last active November 8, 2016 10:42
Get your Gists from your Gist account Python
#! /usr/bin/python
import urllib, json
URL = "https://api.github.com/users/rathankalluri/gists" #https://api.github.com/users/<git-hub username>/gists
response = urllib.urlopen(URL)
data = json.loads(response.read())
for i in range(0,len(data)):
filename = data[i]['files'].values()[0]['filename']
@rathankalluri
rathankalluri / getLinks.py
Created March 2, 2017 08:51
Get URLs from a page - Python
@rathankalluri
rathankalluri / DiffBtwDates.py
Last active March 19, 2017 12:25
Difference between dates (Not using Built-In Functions and Lists)
#!/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}:
@rathankalluri
rathankalluri / Webcrawler.py
Last active October 27, 2019 21:48
WebCrawler
#!/usr/bin/python
import urllib
def get_page(page):
if(seed != ''):
return urllib.urlopen(page).read()
else:
return ''
def get_next_url(page):
@rathankalluri
rathankalluri / yoast.php
Last active December 19, 2019 21:48
Yoast wp-json API
<?php
// ..... add the following in wordpress functions.php file
/**
* Yoast Rest API Customized
*/
function wp_yoast_rest( WP_REST_Request $request ){
$post_id = $request ['post_id'];
$title = $request['seo_title'];
$desc = $request['seo_desc'];
@rathankalluri
rathankalluri / csv_remove_rename.py
Created July 26, 2018 12:50
Remove row from CSV and store into New
import csv
import os
src = 'Users.csv'
dst = 'Users_new.csv'
with open(src, 'rb') as inp, open(dst, 'wb') as out:
writer = csv.writer(out)
reader = csv.reader(inp)
next(reader, None)