Skip to content

Instantly share code, notes, and snippets.

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

unclebean

🏠
Working from home
View GitHub Profile
@unclebean
unclebean / test
Last active November 6, 2024 10:12
flyway embedded postgres
<dependencies>
<!-- JUnit 5 Dependency for Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.3</version> <!-- Use the latest stable version -->
<scope>test</scope>
</dependency>
<!-- Flyway Dependency -->
@unclebean
unclebean / FileUtils.kt
Last active November 5, 2024 09:46
tiff2pdf_kotlin
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.StandardCopyOption
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
import java.util.zip.ZipOutputStream
@unclebean
unclebean / App.js
Last active November 1, 2024 05:49
entra id integration
// App.js
import React from "react";
import { MsalProvider } from "@azure/msal-react";
import msalInstance from "./msalConfig";
import MainContent from "./MainContent";
function App() {
return (
<MsalProvider instance={msalInstance}>
<MainContent />
@unclebean
unclebean / p12 in docker
Last active October 28, 2024 02:12
postgres initial DB
keytool -genkeypair -alias myalias -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore mykeystore.p12 -validity 3650
openssl pkcs12 -export -in cert.pem -inkey key.pem -out mykeystore.p12 -name myalias
# Copy the .p12 file into the Docker image
COPY mykeystore.p12 /path/to/keystore/mykeystore.p12
@unclebean
unclebean / h2
Last active October 16, 2024 03:32
maven local dependency
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>install-jar</id>
<phase>validate</phase>
@unclebean
unclebean / gist:ae6ac6963bbbf444f627c35db0188383
Last active October 11, 2024 06:20
spn vs uami vs sami
| **Feature** | **Service Principal** | **System-Assigned Managed Identity (SAMI)** | **User-Assigned Managed Identity (UAMI)** |
|---------------------------------|--------------------------------------------------------------------|----------------------------------------------------------------------|----------------------------------------------------------------------|
| **Creation** | Created manually in Azure AD by registering an application. | Automatically created and managed by Azure for a resource. | Created manually and assigned to resources as needed. |
| **Assignment to Resources** | Can be assigned roles or permissions to access resources. | Tied to a single Azure resource (VM, App Service, etc.). | Can be shared and assigned to multiple resources. |
| **Lifecycle** | Sta
@unclebean
unclebean / yml
Created October 10, 2024 09:21
ci/cd
stages:
- build
- deploy
# Variables for your project
variables:
IMAGE_NAME: "registry.example.com/your-project/your-image" # Docker image path
DOCKER_TAG: "${CI_COMMIT_SHA:0:8}" # Tag Docker image with commit SHA
# Build and push Docker image
@unclebean
unclebean / maven-jar-plugin
Last active October 22, 2024 02:44
add repo config in pom
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- Add repositories for dependencies -->
@unclebean
unclebean / AKS deployment
Created October 10, 2024 05:51
docker for AKS deployment
spec:
containers:
- name: your-app
image: your-app:dev
ports:
- containerPort: 8080
env:
- name: SPRING_PROFILES_ACTIVE
value: "dev"
<!-- Spring Cloud Azure Starter -->
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-starter</artifactId>
</dependency>
<!-- Azure Blob Storage -->
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-starter-storage-blob</artifactId>