Skip to content

Instantly share code, notes, and snippets.

View dheshanm's full-sized avatar

Dheshan Mohandass dheshanm

View GitHub Profile
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf
from tqdm import tqdm
# import tensorflow_io as tfio
import cv2
from sklearn.metrics import accuracy_score, precision_score, recall_score
@dheshanm
dheshanm / tile.py
Created March 23, 2021 14:05
Image Tilimg
import cv2
import math
import os
# Source: https://stackoverflow.com/questions/37842476/image-tiling-in-loops-using-python-opencv
# credit: https://stackoverflow.com/users/2561733/telepinu
Path = "FullImage.tif";
filename, file_extension = os.path.splitext(Path)
image = cv2.imread(Path, 0)
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
create table employee (
fname varchar2(15),
mname char(2),
lname varchar2(15),
ssn char(9),
bdate date,
address varchar2(50),
sex char(1),
salary number(7),
superssn char(9),
#
# ~/.bashrc
#
[[ $- != *i* ]] && return
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
import java.util.*;
class NodeHuffman {
int freq;
char character;
NodeHuffman left;
NodeHuffman right;
}
import java.util.*;class NodeHuffman { int freq; char character; NodeHuffman left; NodeHuffman right;}class MinComparator implements Comparator<NodeHuffman> { @Override public int compare(NodeHuffman x, NodeHuffman y) { return x.freq - y.freq; }}public class Huffman { public static HashMap<Character,String> cipher= new HashMap<Character,String>(); public static void printCode(NodeHuffman root, String s) { if (root.left == null && root.right == null && Character.isLetter(root.character)) { cipher.put(root.character,s); System.out.println(root.character + ":" + s); return; } printCode(root.left, s + "0"); printCode(root.right, s + "1"); } // main function public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter a String that needs to be encoded to Huffman Code :"); String input = in.nextLine(); HashMap<Character,Integer> m
@dheshanm
dheshanm / Source.cpp
Created February 22, 2018 17:49
Display Binary Tree
void displayTree(Node * root) {
std::vector<Node*> GlobalStack;
GlobalStack.push_back(root);
int emptyLeaf = 32;
bool isRowEmpty = false;
std::cout << "****......................................................****";
while (!isRowEmpty) {
std::vector<Node*> LocalStack;
isRowEmpty = true;
for (int j=0; j<emptyLeaf; j++) {
procedure insertionSort( A : array of items )
int holePosition
int valueToInsert
for i = 1 to length(A) inclusive do:
/* select value to be inserted */
valueToInsert = A[i]
holePosition = i
procedure selection sort
list : array of items
n : size of list
for i = 1 to n - 1
/* set current element as minimum*/
min = i
/* check the element to be minimum */