Skip to content

Instantly share code, notes, and snippets.

View nithinivi's full-sized avatar
🎯
Focusing

निധിin nithinivi

🎯
Focusing
View GitHub Profile
@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
@nithinivi
nithinivi / gender_classifier_generator.py
Last active March 27, 2019 10:29
Gender Classifier Generator using Tpot
import time
import numpy as np
import sklearn.metrics
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.ensemble import RandomForestClassifier
from sklearn import svm
from tpot import TPOTClassifier
def name_count(name):
@nithinivi
nithinivi / index.html
Last active February 26, 2019 08:59
particles.js demo
<!-- particles.js container --> <div id="particles-js"></div> <!-- stats - count particles --> <div class="count-particles"> <span class="js-count-particles">--</span> particles </div> <!-- particles.js lib - https://github.com/VincentGarreau/particles.js --> <script src="http://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script> <!-- stats.js lib --> <script src="http://threejs.org/examples/js/libs/stats.min.js"></script>