This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import urllib2, re,sys | |
a='' | |
if len(sys.argv) == 2: | |
a=sys.argv[1] | |
else: | |
a=raw_input("Enter the url :") | |
req = urllib2.Request(a) | |
resp = urllib2.urlopen(req) | |
html = resp.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IDENTIFICATION DIVISION. | |
PROGRAM-ID. FILE-SEARCH. | |
AUTHOR. CNA. | |
DATE-WRITTEN. 19 DECEMBER 2013. | |
************************************************************** | |
* * | |
* ENVIRONMENT-DIVISION * | |
* * | |
************************************************************** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***************Dijkstras shortest Path Algorithm ************************/ | |
#include<iostream> | |
#include<list> | |
#include<map> | |
#include<queue> | |
#include<algorithm> | |
using namespace std; | |
#define INF 1000 | |
class node{ | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************KRUSKALS ALGORITHM********************************/ | |
#include<iostream> | |
#include<set> | |
#include<algorithm> | |
#include<queue> | |
#include<utility> | |
#include<exception> | |
#include<conio.h> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#define sqr(a) ((a)*(a)) | |
using namespace std; | |
unsigned long sqrt(unsigned long a){ | |
unsigned long l=0,u=a,mid = l+(u-l)/2; | |
while(mid*mid != a){ | |
if(sqr(mid) < a){ | |
if(sqr(mid+1)>a){ | |
return mid; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
void move(int n,char* src,char* dest,char* buffer) | |
{ | |
if(n==2){ | |
cout<<"\n1,\t"<<src<<" -->"<<buffer; | |
cout<<"\n2,\t"<<src<<" -->"<<dest; | |
cout<<"\n1,\t"<<buffer<<" -->"<<dest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import urllib2 | |
from os import system | |
lecture='https://class.coursera.org/android-001/lecture' | |
content=urllib2.urlopen(lecture).read() | |
sub=re.compile(r'https://class.coursera\.org/android-001/lecture/subtitles\?q=[0-9]+_en\&format=srt') | |
vid=re.compile(r'https://class\.coursera\.org/android-001/lecture/download\.mp4\?lecture_id=[0-9]+') | |
for i in sub.findall(content): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import re | |
import urllib2 | |
from os import system | |
from sys import argv | |
if len(argv) != 2: | |
print "The format is incorrect" | |
exit(0) | |
lecture=argv[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import requests | |
from sys import argv | |
def get_distance(origin,destination): | |
gmap='http://maps.googleapis.com/maps/api/distancematrix/json' | |
payload={"origins":origin,"destinations":destination,"sensor":'false' } | |
try: | |
a=requests.get(gmap,params=payload) | |
data = a.json() | |
origin = str(data['origin_addresses'][0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--sorting algorithm inspired from quick sort in haskel | |
ksort :: [Int]->[Int] | |
ksort [] = [] | |
ksort (k:a) = ksort [i|i<-a,i<=k]++(k:(ksort [i|i<-a,i>k]) ) | |
main = do | |
input <- getLine | |
let output::[Int] | |
output = read input | |
putStrLn (show (ksort output )) |
OlderNewer