Skip to content

Instantly share code, notes, and snippets.

View leonard84's full-sized avatar
💭
I may be slow to respond.

Leonard Brünings leonard84

💭
I may be slow to respond.
  • Gradle Inc.
View GitHub Profile
@leonard84
leonard84 / zipServer.groovy
Created March 20, 2024 14:44
This script starts a http server that serves the contents of a zip file.
#!/usr/bin/env groovy
/**
* Usage: groovy <scriptName> [port] path-to-zip-file
*
* This script starts a http server that serves the contents of a zip file.
* The zip file is specified as a command-line argument.
* The server listens on port 8080 by default, but you can adjust it as necessary.
* If you pass 0 as the port parameter, then a random port will be selected.
* The server serves the files in the zip file and provides directory listing for directories.
@leonard84
leonard84 / inner-kungfu.txt
Created December 15, 2023 13:41
Matchless Kungfu
Art of Harmony: AGOAG
Breathing Skill: OAG
Art of Drunkness: OAA
Golden Accupuncture: GOGAOA
Art of Marrow Refining: GAOGG
Poison Proof Spell: GGAOA
Heart Burning Spell: GGA
Bionic Pentaform: AGOGA
Dragon Tiger Hunt: AGOO
Art of Heartflame: AOOGGA
@leonard84
leonard84 / asdfUpdate.groovy
Created October 21, 2022 10:03
A simple groovy script that shows available updates for `asdf list java` installed Java versions, and outputs the necessary commands to install/uninstall.
#!/usr/bin/env groovy
import groovy.transform.Immutable
import java.util.regex.Pattern
@Immutable
class Version implements Comparable<Version> {
static Pattern NAME_AND_MAJOR_VERSION = ~/^(?<nameVersionPrefix>\w+-(?<major>\d+))(?<remainder>.*)/
static Pattern VERSION_NUMBER_ELEMENT = ~/\D*(\d+)\D*/
String version
import spock.lang.*
class ASpec extends Specification {
def "hello world"() {
expect: true
}
}
@leonard84
leonard84 / prepare-mods.ps1
Last active November 1, 2023 12:16
Prepare mods for factorio.zone
# What is this?
#
# This is a script I wrote to automate the process of removing images and soundfiles from mods,
# so that they can be uploaded to factorio.zone without taking forever or even exceed the max-upload size.
# It also creates a mod-settings.zip so that your mod-settings.dat (Startup Settings) are available on the server.
#
# How to use
#
# Download the script and put it somewhere on you harddrive, e.g., C:\temp\factorio
# Open a powershell prompt "Win+x, i" or just type powershell in the startmenu.
@leonard84
leonard84 / JabbaExt.psm1
Created January 14, 2020 12:25
A Module to make Jabba usage a bit nicer
function Jabba-Use
{
param(
[Parameter(Mandatory)]
[string]$Version
)
jabba use $Version
}
@leonard84
leonard84 / update-toolchains.ps1
Created December 19, 2019 15:18
Update toolchains.xml using jabba managed jdks
# check if jabba is installed
Get-Command -ErrorAction Stop jabba > $null
function Resolve-PathSymlink
{
param(
[string]
$Path
)
$item = Get-Item $Path
public doCall(java.lang.Object arg0) { //(Ljava/lang/Object;)Ljava/lang/Object;
<localVar:index=0 , name=this , desc=LTryCatchProblem$_test_closure1;, sig=null, start=L1, end=L2>
<localVar:index=1 , name=it , desc=Ljava/lang/Object;, sig=null, start=L1, end=L2>
<localVar:index=2 , name=collector , desc=LErrorCollector;, sig=null, start=L3, end=L2>
<localVar:index=3 , name=e , desc=Ljava/lang/Throwable;, sig=null, start=L4, end=L5>
<localVar:index=5 , name=e , desc=Ljava/lang/Throwable;, sig=null, start=L6, end=L7>
<localVar:index=8 , name=e , desc=Ljava/lang/Throwable;, sig=null, start=L8, end=L9>
TryCatch: L10 to L11 handled by L11: java/lang/Throwable
TryCatch: L10 to L11 handled by L12: Type is null.
@leonard84
leonard84 / groovy-2.4.10-Result
Created June 13, 2017 16:14
TryCatchProblem - Results
java.lang.AssertionError: a
at org.junit.Assert.fail(Assert.java:88)
at TryCatchProblem$_test_closure1.doCall(TryCatchProblem.groovy:15)
at TryCatchProblem$_test_closure1.call(TryCatchProblem.groovy)
at TryCatchProblem.test(TryCatchProblem.groovy:33)
...
java.lang.AssertionError: b
public class org/spockframework/verifyall/VerifyTest extends spock/lang/Specification implements groovy/lang/GroovyObject {
private synthetic static org.codehaus.groovy.reflection.ClassInfo $staticClassInfo;
public synthetic static transient boolean __$stMC;
private synthetic transient groovy.lang.MetaClass metaClass;
private synthetic static org.codehaus.groovy.reflection.ClassInfo $staticClassInfo$;
private synthetic static java.lang.ref.SoftReference $callSiteArray;
public VerifyTest() { // <init> //()V
<localVar:index=0 , name=this , desc=Lorg/spockframework/verifyall/VerifyTest;, sig=null, start=L1, end=L2>