Skip to content

Instantly share code, notes, and snippets.

View gb103's full-sized avatar

Gaurav Bansal gb103

View GitHub Profile
/**
* sortedScoreTreeSet : Keep all score entries into sorted order.
* trackScoreShuffler : Provide the Map of uniqueue Id and their timestamp based on score, it
* provides the uniqueue Id for the oldest entry for given score. As there can be multiple item of same score,
* that's why used linkedHashMap
* trackScoreMap : Used to check if a item entry is present into the queue and return the item
*/
private var sortedScoreTreeSet //<score>
: TreeSet<Float>
private var trackScoreShuffler // <score, LinkedHashMap<uniqueId, timestamp>
@gb103
gb103 / index.js
Last active March 19, 2021 07:45
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const nodemailer = require('nodemailer');
const cors = require('cors')({origin: true});
const rp = require('request-promise');
const jsonDiff = require('json-diff');
//const jsondiffpatch = require('jsondiffpatch').create();
//const deepDiff = require('deep-diff').diff;
admin.initializeApp(functions.config().firebase);
[length:03:05.42]
[re:www.megalobiz.com/lrc/maker]
[ve:v1.2.3]
[00:21.73]Ni lakk tera patla jea
[00:23.69]Patla jea
[00:25.19]Jado turdi 17 vall khawe
[00:27.02]Morni ji tor kudiye
[00:29.02]Tor kudiye
[00:30.44]Hun mundyan nu hosh kitho aawe
[00:32.29]Ni nagni di akh waliye
class LrcRow {
public long time; //lyrics start time in the timestamp format
public String content; //lyrics content
public String strTime; // lyrics start time in raw format
}
ArrayList<LrcRow> rowsList = new ArrayList<>();
LrcRow lrcRow1 = new LrcRow(timestamp(00:21:73), Ni lakk tera patla jea, 00:21:73)
LrcRow lrcRow2 = new LrcRow(timestamp(00:23.69), Patla jea, 00:23.69)
LrcRow lrcRow3 = new LrcRow(timestamp(00:25.19), Ni lakk tera patla jea, 00:25.19)
………..
……….
…….
rowsList.add(row1)
rowsList.add(row2)
rowsList.add(row3)
import android.os.Handler;
public class LrcPosition {
Handler handler = new Handler();
handler.postDelayed(runnable, 1000);
Runnable runnable = new Runnable() {
public void run() {
int currentPosition = player.getCurrentPosition;
for(int a=0; a<rowList.length; a++) {
@gb103
gb103 / face-match-run.sh
Created January 6, 2021 11:12
face match commands to execute python scripts.
python3 createdb.py
python3 createtable.py
python3 facedata.py
python3 facetrain.py
python3 facerecognisation.py
@gb103
gb103 / facerecognisation.py
Created January 6, 2021 11:02
Recognise a face and mark it
import cv2
import numpy as np
import sqlite3
#faceDetect=cv2.CascadeClassifier('haarcascade_frontalface_default.xml');
faceDetect = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')
cam=cv2.VideoCapture(0);
#rec=cv2.createLBPHFaceRecognizer();
rec = cv2.face.LBPHFaceRecognizer_create()
rec.read("recognizer/trainningData.yml")
@gb103
gb103 / facetrain.py
Created January 6, 2021 11:01
Train a model from image database and create a .yml file.
import os
import cv2
import numpy as np
from PIL import Image
#recognizer=cv2.createLBPHFaceRecognizer();
recognizer = cv2.face.LBPHFaceRecognizer_create()
path='dataSet'
def getImagesWithID(path):
@gb103
gb103 / facedata.py
Last active January 6, 2021 10:57
To capture the face images
import cv2
import numpy as np
import sqlite3
#faceDetect=cv2.CascadeClassifier('haarcascade_frontalface_default.xml');
faceDetect = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')
cam=cv2.VideoCapture(0);
def insertOrUpdate(Id,Name,Age,Gen,CR):