Skip to content

Instantly share code, notes, and snippets.

View ducseul's full-sized avatar
🏠
Working from home

ducseul ducseul

🏠
Working from home
View GitHub Profile
@ducseul
ducseul / java17.ps1
Last active August 13, 2025 08:16
Java version change alias
$javaPath = "C:\Program Files\Java\jdk-17"
$env:JAVA_HOME = $javaPath
# Clean and prepend new Java path
$env:Path = ($env:Path -split ";" | Where-Object { $_ -notmatch "Java\\jdk" }) -join ";"
$env:Path = "$javaPath\bin;$env:Path"
# Function to check for admin without producing error output
function Test-IsAdmin {
$currentUser = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
@ducseul
ducseul / restart.sh
Created March 2, 2025 15:43
Script for quick restart tomcat
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@ducseul
ducseul / TimeOutHashMap.java
Last active May 5, 2025 15:59
Basically it's ConcurrentHashmap that auto remove data that being timeout set by prunceTime. It's quick way to implement local cache (Memory cache)
package com.ducseul.staff.catalyst.utils;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* @author ducnm62
@ducseul
ducseul / MapUtils.java
Last active March 12, 2025 04:33
Quick java snippet for quick initialize a Map of HashMap or specific one
package com.viettel.utils;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* @author ducnm62
* Create at: 2/10/2025 4:42 PM
* Map<String, Object> param = HashMapUtils.<String, Object>builder()
@ducseul
ducseul / SetUtils.java
Last active March 2, 2025 15:18
Quick java snippet for quick initialize a Set of HashSet
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class SetUtils {
public static <T> Builder<T> builder() {
return new Builder<>();
}