Skip to content

Instantly share code, notes, and snippets.

View ramsunvtech's full-sized avatar
💭
Full Stack Developer (Java, React, React Native)

Venkat.R ramsunvtech

💭
Full Stack Developer (Java, React, React Native)
View GitHub Profile
@ramsunvtech
ramsunvtech / ChromeInstallationComponent.js
Created April 25, 2024 13:49
Chrome Installation React Component
import React from 'react';
const ExtensionInstaller = () => {
const handleDrop = (event) => {
event.preventDefault();
const file = event.dataTransfer.files[0];
if (file.name.endsWith('.crx') || file.name.endsWith('.zip')) {
const reader = new FileReader();
reader.onload = (event) => {
const url = event.target.result;
@ramsunvtech
ramsunvtech / image_to_string.py
Created February 25, 2024 04:38
Image to Text using pytesseract
from PIL import Image
import pytesseract
# Load the image from file
img_path = '/mnt/data/image.png'
img = Image.open(img_path)
# Use tesseract to do OCR on the image
text = pytesseract.image_to_string(img)
@ramsunvtech
ramsunvtech / BinarySearchIterative.js
Created November 5, 2021 16:45
Binary Search Iterative
function binarySearchIterative(inputArray, searchTerm) {
let left = 0;
let right = inputArray.length - 1;
while(left <= right) {
const midPoint = Math.floor((left + right) / 2);
if (inputArray[midPoint] === searchTerm) {
return true;
} else if (searchTerm < inputArray[midPoint]) {
@ramsunvtech
ramsunvtech / binarySearchRecursive.js
Created November 5, 2021 16:38
Binary Search Recursive
function searchRecursive(inputArray, searchTerm, left, right) {
if (left > right) {
return false;
}
const midPoint = Math.floor((left + right) / 2);
if (inputArray[midPoint] === searchTerm) {
return true;
} else if (searchTerm < inputArray[midPoint]) {
@ramsunvtech
ramsunvtech / nginx-micro-frontend-config.conf
Created January 10, 2021 10:49
Nginx Microfrontend Configuration
server {
ssi on;
proxy_intercept_errors on;
location /product-list {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
@ramsunvtech
ramsunvtech / groupAndSum.js
Created January 7, 2021 05:23
Group and Sum Array Items
// Group and sum the value.
function groupAndSum(list) {
const existingItems = {}
list.forEach((item) => {
if (!existingItems[item.name]) {
existingItems[item.name] = item;
return;
}
existingItems[item.name] = {
@ramsunvtech
ramsunvtech / isNumber.js
Created September 22, 2019 17:54
isValidNumber.js
/*
Validate if a given string can be interpreted as a decimal number.
Some examples:
"0" => true
" 0.1 " => true
"abc" => false
"1 a" => false
"2e10" => true
" -90e3 " => true
@ramsunvtech
ramsunvtech / Stack.js
Created August 13, 2019 17:37
Stack.js
// Stack -
// Push - Add value at end
// Pop - Remove and return the end of the stack
// Peek - Return the end value of the stack
// Size - Return the size
function Stack() {
let count = 0;
let storage = {};
@ramsunvtech
ramsunvtech / tableSumInVannila.js
Created July 21, 2019 01:53
Table Sum in Vanila
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bittitan</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
"use strict";
const tree = {
left: null,
right: null,
parent: null,
value: '0',
};
const node1 = {