Skip to content

Instantly share code, notes, and snippets.

View JanisBe's full-sized avatar

Janis Blatsios JanisBe

View GitHub Profile
@JanisBe
JanisBe / Cf.java
Created October 21, 2025 12:49
cf
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.*;
public class ApiCaller {
// Result wrapper to handle both success and failure cases
public static class ApiResult<T> {
private final String id;
private final T data;
const computeWindow = document.querySelector("#compute-wrapper")
? window
: document.querySelector("#sandbox-compute-container")?.contentWindow;
if (!computeWindow)
throw new Error("Failed to find iframe window");
const createBtn = computeWindow.document.querySelector(".oui-savant__Panel--Footer .oui-button.oui-button-primary");
if (!createBtn || createBtn.textContent !== "Create")
throw new Error("Failed to find 'Create' button");
@JanisBe
JanisBe / qff.java
Created March 10, 2025 09:09
quickfix
package com.example.quickfix;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import quickfix.*;
import quickfix.field.MsgType;
import quickfix.fix44.NewOrderSingle;
@JanisBe
JanisBe / GatewayITest.java
Created September 10, 2024 13:29
GatewayTests
package org.example.gatewaytest;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import com.github.tomakehurst.wiremock.client.WireMock;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@JanisBe
JanisBe / pom.xml
Created August 14, 2024 09:06
pom do openapi
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.7.0</version>
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.util.function.Supplier;
import org.springframework.security.web.csrf.CsrfToken;
import org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler;
import org.springframework.security.web.csrf.CsrfTokenRequestHandler;
import org.springframework.security.web.csrf.XorCsrfTokenRequestAttributeHandler;
import org.springframework.util.StringUtils;
import org.springframework.web.util.WebUtils;
saveAsPDF(): void {
// Get the HTML content of the component
const content = this.contentToConvert.nativeElement;
// Options for html2pdf
const options = { filename: 'your-file-name.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2 } };
// Use html2pdf to generate PDF
html2pdf().from(content).set(options).outputPdf(pdf => {
// Save the PDF