Skip to content

Instantly share code, notes, and snippets.

View kp96's full-sized avatar

Krishna Kalubandi kp96

View GitHub Profile
@kp96
kp96 / imdb_rating.py
Last active September 21, 2016 11:41
IMDB Get Movie's First Review
from bs4 import BeautifulSoup
import requests
req = requests.get('http://www.imdb.com/title/tt0068646/reviews')
review_soup = BeautifulSoup(req.text, "html.parser")
print (review_soup.find("div", {"id" : "tn15content"}).findAll('p'))[1]
# pip install requests, bs4
@kp96
kp96 / MidpointCircle.cpp
Created February 28, 2016 18:45
Cirlce Drawing using Midpoint Algorithm
#include <stdio.h>
#include <graphics.h>
#include <math.h>
int max(int a, int b) {return a > b ? a : b;}
void draw_cirlce(int, int, int, int);
int main(int argc, char const *argv[])
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "Midpoint Circle Drawing");
int xc = 320, yc = 240; //co-ordinates
@kp96
kp96 / BresenhamCircle.cpp
Created February 28, 2016 18:22
CirleDrawingAlgorithm
#include <stdio.h>
#include <graphics.h>
#include <math.h>
int max(int a, int b) {return a > b ? a : b;}
void draw_cirlce(int, int, int, int);
int main(int argc, char const *argv[])
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "Bresenham Circle Drawing");
int xc = 320, yc = 240; //co-ordinates
@kp96
kp96 / BresenhamAlgorithm.cpp
Created February 28, 2016 17:34
BresenhamAlgorithm
#include <stdio.h>
#include <graphics.h>
#include <math.h>
int max(int a, int b) {return a > b ? a : b;}
int main(int argc, char const *argv[])
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "Bresenham Line Drawing");
int x1, y1, x2, y2;
x1 = 5, y1 = 5, x2 = 32, y2 = 54;
@kp96
kp96 / DDAAlgorithm.cpp
Last active February 28, 2016 17:33
DDA Algorithm
#include <stdio.h>
#include <graphics.h>
#include <math.h>
int max(int a, int b) {return a > b ? a : b;}
int main(int argc, char const *argv[])
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "DDA Line Drawing");
int x1, y1, x2, y2;
x1 = 5, y1 = 5, x2 = 32, y2 = 54;
@kp96
kp96 / GenralLineDrawingAlgorithm.cpp
Last active February 28, 2016 17:28
GenralLineDrawingAlgorithm
#include <graphics.h>
#include <stdlib.h>
int main() {
int gd = DETECT, gm;
int x1,y1,x2,y2;
initgraph(&gd,&gm,"DDA");
x1 = 5, y1 = 5, x2 = 32, y2 = 54;
float m = (y2 - y1) * 1.0 / (x2 - x1) * 1.0;
float c = y2 - m * x2;
@kp96
kp96 / BALLSUM.cpp
Created December 20, 2015 07:56
Spoj solution to BALLSUM
/*
* @Author: Krishna
* @Date: 2015-12-20 04:38:55
* @Last Modified by: Krishna
* @Last Modified time: 2015-12-20 06:44:20
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
@kp96
kp96 / BSTree.java
Last active December 7, 2015 20:02
Simple implementation of binary serach tree data structure with ints.
import java.util.Scanner;
public class BSTree {
private TreeNode root;
public BSTree() {
this.root = null;
}
public TreeNode getTreeRoot() {
return this.root;
}
public void insert(int val) {
@kp96
kp96 / Trie.java
Created December 7, 2015 12:47
Trie datastructure simple implementation of insert and delete in java
//import java.util.*;
public class Trie {
private static final int ALPHABET_SIZE = 26;
private TrieNode root;
private int count;
public Trie() {
this.root = new TrieNode();
this.count = 0;
}
public void insert(String key) {
@kp96
kp96 / package.json
Created December 5, 2015 13:15
express session management tutorial
{
"name": "sessionmgmt",
"version": "1.0.0",
"description": "a simple sessionmgmt app",
"main": "app.js",
"license": "ISC",
"dependencies": {
"express": "^4.13.3",
"express-session": "^1.12.1"
}