Skip to content

Instantly share code, notes, and snippets.

View indrajithi's full-sized avatar
:octocat:
Namaste

Indrajith Indraprastham indrajithi

:octocat:
Namaste
View GitHub Profile
@indrajithi
indrajithi / insertion_sort.c
Last active August 29, 2015 14:05
INSERTION SORT IN C
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
main()
{
int a[100],i,j,key;
srand(time(NULL));
for(i=1; i<=10; i++)
@indrajithi
indrajithi / merge_sort.c
Last active August 29, 2015 14:05
MERGE SORT IN C
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define A_MAX 100
#define MAX 999
int main()
{
int a[A_MAX],i,j,flag=0;
@indrajithi
indrajithi / merge_sort2.c
Created August 28, 2014 09:09
Merge Sort Without Sentinels
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define ARRAY_MAX 100
#define MAX 999999
int main()
{
int array[ARRAY_MAX],i,j,flag=0;
@indrajithi
indrajithi / lex_expression.l
Created August 18, 2015 20:18
Lex Program to check the entered arithmetic operation is valid or not
// Lex Program to check the entered arithmetic operation is valid or not
// Programmer: Indrajith Indraprastham
// Date : 19 AUG 2015 ; 1:34
// Note:
// Final expr with (a+b)*(a-b): ^({op1})({op1}?{op2}{op1}{op1}?)*{op2}?{op1}$
// Final expr with (a+b)(a-b) : ^({op1})({op1}*{op2}{op1}{op1}*)*{op2}?{op1}$
// ^({op1} : starts with op1;
// ({op1}*{op2}{op1}{op1}*)* : matches a+b+c+d
// {op2}?{op1}$ : ends expr with op1
@indrajithi
indrajithi / contest.c
Created September 6, 2015 21:14
CodeChef Contest
//Sunday 06 September 2015 10:56:37 PM IST
//Programmer: Indrajith indraprastham
// Other link: http://hostcode.sourceforge.net/view/3332
/*............... Question ...................
Chef has just started Programming, he is in first year of Engineering. Chef is reading about Relational Operators.
Relational Operators are operators which check relatioship between two values. Given two numerical values A and B you need to help chef in finding the relationship between them that is,
First one is greater than second or,
alert("success");
#Sat Feb 11 02:27:07 IST 2017
#Indrajith Indraprastham
from subprocess import call
import os
from os import listdir
from os.path import isfile, join
#get current directory path
mypath = os.getcwd()
import glob
import subprocess
for file in glob.glob('*.mp4'):
out = file[:len(file)-3]+"mp3"
proc = subprocess.Popen(["ffmpeg","-i",file,out,"-y"], stdout=subprocess.PIPE)
@indrajithi
indrajithi / crawler.py
Last active May 3, 2018 09:45
A tiny web crawler in Python
# -*- coding: utf-8 -*-
# filename: crawler.py
# Author: Indrajith Indraprastahm
# Lisence: GPL v3: http://www.gnu.org/licenses/
#--------------------------------------------------------------------------------
# README
#--------------------------------------------------------------------------------
# Install Requirements
# pip install validators beautifulsoup4 lxml
@indrajithi
indrajithi / xpath_soup.py
Created May 28, 2018 19:56 — forked from ergoithz/xpath_soup.py
Generate unique XPATH for BeautifulSoup element
import itertools
def xpath_soup(element):
"""
Generate xpath of soup element
:param element: bs4 text or node
:return: xpath as string
"""
components = []
child = element if element.name else element.parent