Skip to content

Instantly share code, notes, and snippets.

@hargup
hargup / bezier.py
Created September 6, 2013 08:08
Bézier curve fitting
import numpy as np
import matplotlib.pyplot as plt
import random
def Bx(t, px, n):
if n == 1:
return px[0]
else:
return (1-t)*Bx(t, px[:n-1],n-1) + t*Bx(t, px[1:],n-1)
@hargup
hargup / BST
Last active December 24, 2015 21:48
Binary Search Tree
/* Harsh Gupta */
/* 12MA20017 */
#include <stdio.h>
#include <stdlib.h>
typedef struct node{
struct node * parent;
struct node * left_child;
struct node * right_child;
int key;
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char ** argv)
@hargup
hargup / bmf.cpp
Created December 16, 2013 20:40
Bellman Ford
// Author: Harsh Gupta
// Date: 11 November 2013
// Implementation of Bellman Ford Algorithm
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define V 6 // Max Size of The Matrix
const float inf = 99999;
// Author: Harsh Gupta
// Date: 12 November 2013
// Implementation of Prim's algorithm to find the minimum spanning tree
// on a Undirected Graph
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define V 6 // Max Size of The Matrix
// Author: Harsh Gupta
// Date: 12 November 2013
// Implementation of Kruskal algorithm to find the minimum spanning tree
// on a Undirected Graph
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define V 6 // Max Size of The Matrix
@hargup
hargup / without_solve
Created March 10, 2014 16:46
List of Test failure if solve raises an `NotImplementedError()` for every call.
============================= test process starts ==============================
executable: /usr/bin/python (2.7.3-final-0) [CPython]
architecture: 64-bit
cache: yes
ground types: gmpy 1.17
random seed: 61988006
hash randomization: on (PYTHONHASHSEED=1473891933)
sympy/assumptions/tests/test_assumptions_2.py[5] ..... [OK]
sympy/assumptions/tests/test_context.py[4] .... [OK]
@hargup
hargup / CMakeList
Created March 20, 2014 16:30
Sample CMakeList
cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wextra -pedantic -g -O3 -std=c++0x")
endif()
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIR} )
add_executable(hog hog.cpp )
target_link_libraries( hog ${OpenCV_LIBS} )
@hargup
hargup / a_prose_a_day_6_4_14
Last active July 13, 2020 18:51
Electricity at last.
There were a bunch of people sitting on the mattress, playing cards.
They were having a good old laugh.
Even when they were not drinking from the glass.
But that wasn't a scene that would last.
@hargup
hargup / log.txt
Created June 1, 2014 19:47
test failure
============================= test process starts ==============================
executable: /usr/bin/python (2.7.3-final-0) [CPython]
architecture: 64-bit
cache: yes
ground types: gmpy 1.17
random seed: 60443508
hash randomization: on (PYTHONHASHSEED=169529529)
sympy/solvers/tests/test_solve_univariate.py[45] ........fffffffffffffffffffffff
ffffE......... [FAIL]