Skip to content

Instantly share code, notes, and snippets.

View nithinivi's full-sized avatar
🎯
Focusing

निധിin nithinivi

🎯
Focusing
View GitHub Profile
grammar SPQL;
// ---- Parser rule ----
//
spql
: condition EOF
;
condition
: disjunction?
<condition> ::= [ "NOT" ] <disjunction>
<disjunction> ::= <conjunction> { "OR" <conjunction> }
<conjunction> ::= <predicate> { "AND" <predicate> }
<predicate> ::= <expression>
| "(" <condition> ")"
<expression> ::= <column> <comp_op> <value>
@nithinivi
nithinivi / LookupTable.java
Last active August 9, 2024 04:19
LookupTable
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.HashMap;
import java.io.Serializable;
import java.util.Collection;
import java.util.Set;
import java.util.Map;
import java.util.stream.Collectors;
@nithinivi
nithinivi / PredicateExhaustiveSelector.java
Created August 9, 2024 04:11
PredicateExhaustiveSelector
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Objects;
import java.util.function.Predicate;
public class PredicateExhaustiveSelector<O, V> extends HashMap<Predicate<O>, V> {
/**
package sg.dlt.indus.lib.functional;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
/**
* Either Monad represents a value of two possible types. An Either is either a {@link Left} or a
@nithinivi
nithinivi / gist:d976bd666fb0a9c5da8a6a11f7e2d426
Created July 6, 2023 01:27 — forked from mvaz/gist:973464
Graph listener example
package net.mvaz.examples.graph;
import org.jgrapht.DirectedGraph;
import org.jgrapht.alg.DijkstraShortestPath;
import org.jgrapht.event.ConnectedComponentTraversalEvent;
import org.jgrapht.event.TraversalListenerAdapter;
import org.jgrapht.event.VertexTraversalEvent;
import org.jgrapht.graph.SimpleDirectedGraph;
import org.jgrapht.traverse.DepthFirstIterator;
import org.jgrapht.traverse.GraphIterator;
version: '3'
services:
postgresql:
image: postgres:11
volumes:
- db-data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: testuser
ports:
- "5432:5432"
#!/usr/bin/env python
# coding: utf-8
#Usage Example
# python Word_counter.py --folder ./fileFolder --words nithin neetha --out d.csv
import argparse
import csv
@nithinivi
nithinivi / pyenv-install.sh
Last active August 8, 2019 11:03
Installing pyenv in ubuntu
sudo apt-get update
sudo apt-get install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
echo 'export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
source ~/.bashrc
import subprocess
import tempfile
import cv2
import uuid
import os
import matplotlib.pyplot as plt
def textcleaner(img_path):
"""Clean the text with text cleaner