Skip to content

Instantly share code, notes, and snippets.

View tuhin47's full-sized avatar
☠️

MD Towhidul Islam tuhin47

☠️
View GitHub Profile
@tuhin47
tuhin47 / Reading Environment Variables from a Kubernetes ConfigMap YAML.md
Created September 6, 2023 20:10
Reading Environment Variables from a Kubernetes ConfigMap YAML

Reading Environment Variables from a Kubernetes ConfigMap YAML

Preview:
apiVersion: v1
kind: Pod
metadata:
  name: dapi-test-pod
spec:
  containers:
    - name: test-container
@tuhin47
tuhin47 / Docker Compose Maven Plugin Configuration.md
Last active September 6, 2023 19:10
Search code, repositories, users, issues, pull requests... Maven plugin that talks to docker-compose command-line interface - GitHub - br4chu/docker-compose-maven-plugin: Maven plugin that talks to docker-compose command-line interface

Docker Compose Maven Plugin Configuration

Preview:
<plugin>
    <groupId>io.brachu</groupId>
    <artifactId>docker-compose-maven-plugin</artifactId>
    <version>${docker-compose-plugin.version}</version>
    <configuration>
        <projectName>myproject</projectName>
 src/test/resources/custom.docker-compose.yml
@tuhin47
tuhin47 / FindMyIP.py.md
Last active August 30, 2023 18:24
Find Dynamic Public IP in my router

FindMyIP.py

Preview:
import socket
import concurrent.futures

def ping_ip_port(ip, port):
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.settimeout(2)
@tuhin47
tuhin47 / OneEditorConfig
Created August 22, 2023 06:45
Editor Config file
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = false
ij_typescript_keep_indents_on_empty_lines = false
trim_trailing_whitespace = true
@tuhin47
tuhin47 / Image Upload with ImageKit API.md
Created August 20, 2023 03:56
This code snippet uploads an image file to a remote server using the ImageKit API. It retrieves the file name from the command line arguments, prepares the payload and headers for the API request, sends the request, and prints the URL of the uploaded image This code uploads an image to a specified folder using the OpenBSD library and prints its …

Image Upload with ImageKit API

Preview:
#!/usr/bin/python3

import json
import sys
from pathlib import Path

import requests
@tuhin47
tuhin47 / FindMyIP.py
Created July 16, 2023 15:03
Find Dynamic Public IP in my router
import socket
import concurrent.futures
def ping_ip_port(ip, port):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(2)
s.connect((ip, port))
print("http://{}:{}".format(ip,port))
return True
@tuhin47
tuhin47 / Upgrade Java Version.md
Created March 6, 2022 04:05
Upgrade Java from 8 to 11 or higher

Error thrown as :

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory

Solution

<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
@tuhin47
tuhin47 / Java Json Serialize and Deserialize Converter.md
Created June 3, 2021 05:56
Java Json Serialize/deserialize Converter

Serialize

@JsonSerialize

@JsonSerialize(converter = DoubleAmountConverter.class)
private Double grandTotal;

DoubleAmountConverter.java

Find String inside file

grep -rl 'string' **/** | xargs sed -i 's/srtring/replace/g'
@tuhin47
tuhin47 / Spring boot Server Side Pagination.md
Created May 3, 2021 17:09
Spring boot Server Side Pagination Using JPA

GenericSpecification.java

public class GenericSpecification<T> implements Specification<T> {
    private static final long serialVersionUID = 1900581010229669687L;

    private List<SearchCriteria> list;

    public GenericSpecification() {