Skip to content

Instantly share code, notes, and snippets.

View tanayseven's full-sized avatar
🎯
Focusing

Tanay PrabhuDesai tanayseven

🎯
Focusing
View GitHub Profile
@tanayseven
tanayseven / twitter_streaming.py
Last active February 9, 2016 13:59
A script to stream Twitter data using Python, code taken from here http://adilmoujahid.com/posts/2014/07/twitter-analytics/ and modified
#!/usr/bin/env python3
#Import the necessary methods from tweepy library
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
from requests.packages.urllib3.exceptions import ProtocolError
import json
import time
@tanayseven
tanayseven / dls.cpp
Last active January 29, 2016 10:51
Depth Limited Search implementation for AI class
/*
Copyright (c) 2016 Tanay PrabhuDesai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@tanayseven
tanayseven / dfs.cpp
Created January 29, 2016 10:48
Depth First Search Implementation for the studies of AI
#include <iostream>
#include <map>
#include <string>
#include <unordered_set>
#include <stack>
#include <limits>
#include <list>
class UndirectedGraph {
private:
@tanayseven
tanayseven / ucs.cpp
Last active January 29, 2016 05:36
Uniform Cost Search algorithm for Artificial Intelligence practicals
/*
Copyright (c) 2016 Tanay PrabhuDesai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@tanayseven
tanayseven / graph.cpp
Last active January 24, 2016 12:11
A graph class to do bfs and other algorithms on the graph.
/*
Copyright (c) 2016 Tanay PrabhuDesai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@tanayseven
tanayseven / fib_plus_count.c
Created January 20, 2016 14:29
Count of Fibonacci addition reccursion
#include <stdio.h>
int plus_count = 0;
int fib(int n) {
if (n == 0) return 0;
if (n == 1) return 1;
++plus_count;
printf("fib(%d-1)+fib(%d-2)\n", n, n);
return fib(n-1)+fib(n-2);
}
@tanayseven
tanayseven / str_cpy.c
Created November 21, 2015 16:07
OpenCL program to copy a given string n times
#include <stdio.h>
#include "string.h"
#include <fcntl.h>
#include "CL/cl.h"
// #define DATA_SIZE 10
#define BUF_SIZE 256
#define ERROR -1
@tanayseven
tanayseven / mat_mul.c
Created November 20, 2015 11:35
OpenCL program to perform matrix multiplication
#include <stdio.h>
#include <CL/cl.h>
#include <stdlib.h>
#include <fcntl.h>
#define BUF_SIZE 2048
#define ERROR -1
#define END 0
@tanayseven
tanayseven / tolower.c
Created November 18, 2015 14:56
Open CL program to convert from upper to lower case
#include <stdio.h>
#include "string.h"
#include <fcntl.h>
#include "CL/cl.h"
// #define DATA_SIZE 10
#define BUF_SIZE 128
#define ERROR -1
@tanayseven
tanayseven / client.c
Created August 26, 2015 04:38
UDP File server program
/*
The MIT License (MIT)
Copyright (c) 2015 Tanay PrabhuDesai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is