Skip to content

Instantly share code, notes, and snippets.

View crearo's full-sized avatar
🥨

Rish Bhardwaj crearo

🥨
View GitHub Profile
private void fetchContacts() {
ZcsService zcsService = new ZcsService("https://webmail.daiict.ac.in/service/soap", 2, true);
AccountSelector accountSelector = new AccountSelector();
accountSelector.setBy(AccountBy.OPT5_NAME);
accountSelector.setValue(username);
AuthRequest authRequest = new AuthRequest();
authRequest.setAccount(accountSelector);
@crearo
crearo / RCScraper.java
Created April 13, 2016 00:30
DA-IICT Resource Center Data Scraping
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
lines = tuple(open("Books", "r"))
for line in lines:
print line.split(';')[0]
count = 0
for item in finalitems:
print '{"ISBN":"' + item[0] + '",'+ '"place":"' + item[2] + '","accesionNumber":"' + item[1] + '"}'
count += 1
@crearo
crearo / sugar_orm_example.java
Created May 9, 2016 12:24
Sugar ORM Example
import android.util.Log;
import com.orm.SugarRecord;
import com.orm.query.Condition;
import com.orm.query.Select;
import com.orm.util.NamingHelper;
/**
* Created by rish on 6/5/16.
* This is an example of how to use SugarORM (https://github.com/satyan/sugar) - a brilliant lightweight sql handler for Android
@crearo
crearo / EightQueens.java
Created July 26, 2016 21:42
A simple implementation of the 8 queens problem - recursive backtracking.
import java.awt.Point;
public class EightQueens {
/**
* @param args
*/
public static void main(String[] args) {
boolean board[][] = new boolean[8][8];
@crearo
crearo / StackWithMinMax.java
Created July 28, 2016 18:55
A data structure with getMax(), getMin() in O(1) time
public class StackWithMinMax extends Stack<Integer> {
private Stack<Integer> minStack;
private Stack<Integer> maxStack;
public StackWithMinMax () {
minStack = new Stack<Integer>();
maxStack = new Stack<Integer>();
}
@crearo
crearo / LineGraphView.java
Last active July 13, 2017 05:54
A simple line graph view that renders at 60fps. Fast, elegant.
package rish.crearo.imagestabv2;
/**
* Original author unknown.
*
* Modified by rish on 10/7/17.
* bhardwaj.rish@gmail.com
*/
import android.content.Context;
@crearo
crearo / video-side-by-side.py
Created December 15, 2017 10:50
Takes two input videos of the same dimensions and stores them side by side
'''
A small script to play videos of the same dimensions side by side.
I needed this while showing two videos side by side; one stabilized and one not stabilized during my
works on video stabilization.
'''
import cv2, sys
import numpy as np
if len(sys.argv) < 3:
@crearo
crearo / FileLogger.java
Created December 18, 2017 10:11
Provides Android's Log.d() like logging for logging to files
package com.rish.imagestab.utils;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
/**
* Created by rish on 14/6/17.
@crearo
crearo / software-stab.py
Created December 21, 2017 08:06
Simple software stabilization with linear smoothing filter
'''
Performs software stabilization using optical flow + linear smoothing.
Vision algos used :
- KLT for flow tracking
- Harris corner detection to detect points to be tracked in each frame
This is the Python translation I wrote of the original .cpp code written by nghiaho.com/?p=2093
'''
import cv2
import numpy as np