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 / Ai
Last active September 1, 2025 05:07
Karate gatling
import os, requests, textwrap
project_id = os.environ["CI_PROJECT_ID"]
mr_iid = os.environ["CI_MERGE_REQUEST_IID"]
api_base = os.environ.get("CI_API_V4_URL", "https://gitlab.com/api/v4")
gl_token = os.environ["GITLAB_TOKEN"]
# Azure OpenAI settings
aoai_endpoint = os.environ["AZURE_OPENAI_ENDPOINT"].rstrip("/")
aoai_deployment = os.environ["AZURE_OPENAI_DEPLOYMENT"]
'use client';
function HomePageInternal() {
return (
<main>
<header className="sticky top-0 inset-x-0 flex flex-wrap md:justify-start md:flex-nowrap z-48 w-full bg-white border-b border-gray-200 text-sm py-2.5 dark:bg-neutral-800 dark:border-neutral-700">
<nav className="px-4 sm:px-6 flex basis-full items-center w-full mx-auto">
<div className="w-[300px] h-[50px] overflow-hidden flex">
<img src="/quackulator-logo-final.png" alt="Quackulator Logo" />
</div>
@unclebean
unclebean / Azure
Last active July 19, 2025 07:44
AzurePemAuth
import com.microsoft.aad.msal4j.*;
import java.io.*;
import java.nio.file.*;
import java.security.*;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.*;
import java.util.concurrent.*;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.core5.ssl.SSLContextBuilder;
import org.apache.hc.core5.ssl.SSLContexts;
import javax.net.ssl.SSLContext;
import java.io.File;
import java.security.KeyStore;
@unclebean
unclebean / CommonSteps
Last active March 10, 2025 05:11
cucumber
package com.example.app.cucumber.stepdefs;
import io.cucumber.java.en.Given;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.client.RestTemplate;
import org.springframework.http.*;
import java.util.HashMap;
import java.util.Map;
public class CommonSteps {
import com.opencsv.bean.CsvToBean;
import com.opencsv.bean.CsvToBeanBuilder;
import java.io.FileReader;
import java.io.Reader;
import java.util.List;
public class CsvReaderService {
public static List<Person> readCsv(String filePath) {
try (Reader reader = new FileReader(filePath)) {
CsvToBean<Person> csvToBean = new CsvToBeanBuilder<Person>(reader)
$env:AZURE_STORAGE_CONNECTION_STRING = "<your_connection_string>"
az storage blob upload --container-name my-container --name myfile.txt --file "C:\path\to\myfile.txt"
@Service
public class ReactiveSolrService {
@Autowired
private SolrClient solrClient;
public Flux<SolrDocument> queryWithFallback(String preFilter, Predicate<SolrDocument> postFilter, int batchSize) {
return querySolrWithPreFilter(preFilter, batchSize)
.onErrorResume(e -> {
if (isBooleanQueryLimitException(e)) {
@unclebean
unclebean / ingress
Last active March 5, 2025 14:45
k8s
az network nsg rule create --resource-group <your-resource-group> --nsg-name <your-nsg-name> --name AllowHTTPHTTPS --priority 100 --direction Inbound --access Allow --protocol Tcp --source-address-prefix '*' --source-port-range '*' --destination-address-prefix '*' --destination-port-range 80 443
az network nsg rule list --resource-group <your-resource-group> --query "[].{Name:name, Access:access, Port:destinationPortRange}"
@unclebean
unclebean / JwtAuthenticationFilter
Last active February 26, 2025 03:12
spring security
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;