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 / foreignKeyFlaskAlchemy.py
Last active May 8, 2024 23:12
A flask sqlalchemy database with foreign key references and integrity constraints
from flask import Flask, jsonify, request, make_response
from flask.ext.httpauth import HTTPBasicAuth
from flask_sqlalchemy import SQLAlchemy
from flask import render_template, redirect, url_for
from sqlalchemy import UniqueConstraint, exc
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///memes.db'
app.config['SECRET_KEY'] = 'HALO'
@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 / gstreamer-recording.c
Created March 20, 2017 09:45
A Gstreamer example using GstElements to record a v4l2src stream.
#include <string.h>
#include <gst/gst.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
// gst-launch-1.0 v4l2src ! x264enc ! mp4mux ! filesink location=/home/rish/Desktop/okay.264 -e
static GMainLoop *loop;
static GstElement *pipeline, *src, *encoder, *muxer, *sink;
static GstBus *bus;
@crearo
crearo / gstreamer-tee-recording-and-display.c
Created March 20, 2017 11:47
Example of tee in gstreamer. recording + display.
#include <string.h>
#include <gst/gst.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
// v4l2src ! tee name=t t. ! x264enc ! mp4mux ! filesink location=/home/rish/Desktop/okay.264 t. ! videoconvert ! autovideosink
static GMainLoop *loop;
static GstElement *pipeline, *src, *tee, *encoder, *muxer, *filesink, *videoconvert, *videosink, *queue_record, *queue_display;
@crearo
crearo / gstreamer-recording-dynamic.c
Last active January 17, 2024 18:26
Example of dynamic pipeline in Gstreamer (recording + display). Stop recording at will by hitting ctrl+c.
#include <string.h>
#include <gst/gst.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
// v4l2src ! tee name=t t. ! x264enc ! mp4mux ! filesink location=/home/rish/Desktop/okay.264 t. ! videoconvert ! autovideosink
static GMainLoop *loop;