Skip to content

Instantly share code, notes, and snippets.

View muthuishere's full-sized avatar

Muthukumaran Navaneethakrishnan muthuishere

View GitHub Profile
@muthuishere
muthuishere / mockecomstore.sql
Created April 1, 2024 03:03
mock ecom store schema and data
This file has been truncated, but you can view the full file.
-- Drop existing tables if they exist
DROP TABLE IF EXISTS user_profile, inventory, order_detail, payment_details, shipping_details CASCADE;
-- User Profile Table
CREATE TABLE user_profile (
user_id VARCHAR(100) PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100) UNIQUE,
@muthuishere
muthuishere / ClassicThread.java
Created September 21, 2023 17:11
Virtual Thread Demo
import java.util.ArrayList;
import java.util.List;
public class ClassicThread {
void handleRequest() {
@muthuishere
muthuishere / recordmemory.java
Created September 21, 2023 11:29
a way to record memory and time in java
public static <T> void recordMemoryUsage(T count,Consumer<T> fn){
Runtime runtime = Runtime.getRuntime();
// Run the garbage collector
runtime.gc();
// Calculate the used memory
long memory = runtime.totalMemory() - runtime.freeMemory();
long startTime = System.nanoTime();
System.out.println("Used memory before operation is: " + memory + " bytes");
@muthuishere
muthuishere / move_windows_from_one_montor_to_other.scpt
Created February 25, 2023 05:12
Applescript to move all the windows from in accessible leftmost monitor to accesible external monitor
-- Change the windows which should not be moved
set MAXIMUM_X_VALUE to 1900
set positiontobemove to 0
tell application "System Events"
set allProcesses to a reference to (every process whose background only is false)
set windowList to {}
repeat with thisProcess in allProcesses
@muthuishere
muthuishere / free-up-port.bat
Created October 27, 2022 03:09
Batch file script to free up port
@echo off
set PORT_NUMBER= 8080
netstat -a -n -o | findstr %PORT_NUMBER% > tmpFile
set /p input= < tmpFile
del tmpFile
set PROCESS_ID_INDEX=5
for /F "tokens=%PROCESS_ID_INDEX% delims= " %%a in ("%input%") do set PROCESS_ID=%%a
@muthuishere
muthuishere / rename-capture.sh
Created August 11, 2022 07:48
rename multiple files bash
# deploy-3.sh
# deploy-o.sh
# deploy-l.sh
#To convert deploy to capture
rename 'deploy' capture *.sh
@muthuishere
muthuishere / appComponent.js
Last active March 25, 2022 16:31
Compress Backend & Decompress in Frontend
function App() {
const [data, setData] = useState('Loading...');
useEffect(() => {
getCompressedData().then((result) => {
setData(result);
}).catch((e) => {
@muthuishere
muthuishere / data.clj
Last active January 7, 2022 09:21
BCT Clojure Questions
(def avengers-data [{:dateofbirth "May 29, 1970",
:appearances
["Iron Man"
"The Incredible Hulk (post-credits scene)"
"Iron Man 2"
"Thor (mentioned)"
"The Avengers"
"Iron Man 3"
"Captain America: The Winter Soldier (photo & mentioned)"
results= Try.from(()->newsService.downloadFromNyTimes(topic))
.or(()->newsService.downloadFromHerald(topic))
.or(()->newsService.downloadFromSun(topic))
.get();
// since the for the above case it will be null
// if you would like to get default value
results= Try.from(()->newsService.downloadFromNyTimes(topic))
.or(()->newsService.downloadFromHerald(topic))
.or(()->newsService.downloadFromSun(topic))
.get();