Skip to content

Instantly share code, notes, and snippets.

@beercanx
beercanx / README.md
Last active October 3, 2023 14:03
Retry, Continue or Abort (Jenkins Pipeline) with Colour Support

Create test Jenkins

docker run -it --rm --name jenkins -p '8080:8080' jenkins:alpine

Install

  • Login as Admin
  • Accept the standard plugins
  • Continue as Admin
  • Install AnsiColor plugin
@beercanx
beercanx / Dockerfile
Created August 30, 2023 16:21
Rocky Linux with Java and a custom TLS certificate
FROM rockylinux:9
# Install the JRE and JDK
RUN dnf -y update && \
dnf -y install java-17-openjdk java-17-openjdk-devel
# Create an example certificate to trust
RUN openssl req -nodes -new -x509 -keyout test.baconi.co.uk.key -out test.baconi.co.uk.crt -subj '/C=GB/L=Sheffield/O=Baconi/CN=test.baconi.co.uk' && \
cp -av test.baconi.co.uk.crt /etc/pki/ca-trust/source/anchors/test.baconi.co.uk.crt
@beercanx
beercanx / README.md
Created January 23, 2026 13:09
Searching Dependabot PRs and known security vulnerabilities

Dependabot scripts

A collection of basic look up scripts to find all known vulnerabilities and any outstanding PRs from Dependabot.

Just replace '<<USERNAME>>' with your username, and gh needs to be installed and setup.

Listing all known security vulnerabilities

powershell

gh repo list '<<USERNAME>>' --no-archived --json nameWithOwner -q '.[].nameWithOwner' | ForEach-Object { echo "=== $_ ==="; gh api --paginate "/repos/$_/dependabot/alerts?state=open" --jq '.[] | {number, created_at, "severity": .security_vulnerability?.severity, "package": .security_vulnerability?.package?.name, "summary": .security_advisory?.summary, "url": .html_url}'; }
@beercanx
beercanx / README.md
Last active May 2, 2026 10:37
How to security patch the Android Gradle Plugin

How to security patch the Android Gradle Plugin

Its got two main areas, the plugin itself in the buildscript and its UTP (Unified Test Platform) in the configurations, they share some similar dependencies but not idential and because of this some patching might get missed at a component level.

See the build.gradle.kts for code examples.

For a long time I couldn't understand where the extra dependencies kept coming from, including duplicates of the same library but at different versions, for more details ramblings, and where I initially wrote up my findings go read this beercanx/retro-brick-game-raylib#30 (comment)

Testing

@beercanx
beercanx / README.md
Created April 20, 2026 13:34
JAVA_HOME PowerShell 7+ helper functions

JAVA_HOME PowerShell 7+ helper functions

Crude but effective functions I use to manually manage JAVA_HOME on Windows using Powershell 7+, for those times where a project can only use a certain LTS version.

Placed in the Powershell profile file, it just attempts to find the latest version of the specific version and updates your JAVA_HOME evironment varaible.

If your path setup also relies on JAVA_HOME to add Java commands to the path, this also updates those after a refreshenv.

function jdkFinder($version) {
@beercanx
beercanx / README.md
Created April 20, 2026 13:47
Generating Maven Toolchains from Intellij sourced JDKs

Generating Maven Toolchains from Intellij sourced JDKs

I'm lazy, I use Intellij feature to find and download required JDKs and update with patches.

So Maven has a concept for toolchains, so I want something to generate a fresh ~/.m2/toolchains.xml file when there's changes.

function GenerateMavenToolchains() {

  $toolchainsDocument = [xml]@'
<?xml version="1.0" encoding="UTF-8"?>
<toolchains>
@beercanx
beercanx / README.md
Created April 21, 2026 15:45
Generate Password in PowerShell

Generating a password in PowerShell

A quick, offline, alphanumeric with symbols password generator.

##
# Password Generator: min 1 lower | upper | number | symbol
##
function GeneratePassword([int] $length = 24) {
  
  # Character sets
  $lowerCase = [char[]]([char]'a'..[char]'z')