This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.24-alpine AS builder | |
WORKDIR /app | |
COPY go.mod go.sum ./ | |
RUN go mod download | |
COPY . . | |
# Build the Go application. | |
# CGO_ENABLED=0 disables CGO, making the binary statically linked and independent of system libraries. | |
# -ldflags="-s -w" removes symbol table and debug information, further reducing binary size. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM bellsoft/liberica-openjdk-alpine:23-cds AS builder | |
WORKDIR /application | |
COPY . . | |
RUN --mount=type=cache,target=/root/.m2 chmod +x mvnw && ./mvnw clean install -Dmaven.test.skip | |
FROM bellsoft/liberica-openjre-alpine:23-cds AS layers | |
WORKDIR /application | |
COPY --from=builder /application/target/*.jar app.jar | |
RUN java -Djarmode=tools -jar app.jar extract --layers --destination extracted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using VALUES instead of IN | |
# BEFORE | |
EXPLAIN | |
SELECT * | |
FROM public.salesorder | |
WHERE shipcity IN ('Madrid', 'Lyon') | |
AND custid = '69' | |
AND shipperid = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Extract jar archive -> app.jar + libs/* | |
java -Djarmode=tools -jar my-app.jar extract --destination application | |
# -Dspring.context.exit is for Spring only | |
# Create *.jsa file with a common context | |
java -XX:ArchiveClassesAtExit=application.jsa -Dspring.context.exit=onRefresh -jar application/my-app.jar | |
# Run app using common context |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>org.example</groupId> | |
<artifactId>demo</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<dependencies> | |
<!-- Detecting text encoding --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.nio.file.FileVisitResult; | |
import java.nio.file.FileVisitor; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.nio.file.SimpleFileVisitor; | |
import java.nio.file.attribute.BasicFileAttributes; | |
import java.util.ArrayList; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BLOBSUM="sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" | |
curl \ | |
--silent \ | |
--location \ | |
--request GET \ | |
--header "Authorization: Bearer ${TOKEN}" \ | |
"https://registry-1.docker.io/v2/library/ubuntu/blobs/${BLOBSUM}" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# set username and password | |
UNAME="username" | |
UPASS="password" | |
# get token to be able to talk to Docker Hub | |
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${UNAME}'", "password": "'${UPASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Download mitmproxy | |
echo "DOWNLOAD mitmproxy" | |
wget https://downloads.mitmproxy.org/10.1.1/mitmproxy-10.1.1-linux.tar.gz | |
# Extract archive to ~/.local | |
echo "EXTRACTING archive" | |
tar -xfv mitmproxy-10.1.1-linux.tar.gz mitmproxy -C ~/.local | |
rm ./mitmproxy-10.1.1-linux.tar.gz |
NewerOlder