Skip to content

Instantly share code, notes, and snippets.

@gabrielfeo
gabrielfeo / settings.gradle.kts
Created March 21, 2025 18:01
Capture free disk space to a custom value
import java.nio.file.FileSystems
develocity {
buildScan {
background {
FileSystems.getDefault().getFileStores().forEach {
value("Free space: ${it.name()}", "${it.usableSpace}/${it.totalSpace}")
}
}
}
@gabrielfeo
gabrielfeo / captureFingerprints.gradle
Last active March 13, 2025 18:52 — forked from ghale/captureFingerprints.gradle
Capture task classpath fingerprints in a configuration cache–compatible way
def fingerprinter = services.get(org.gradle.internal.fingerprint.classpath.ClasspathFingerprinter)
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { task ->
def objectFactory = task.project.objects
def buildScan = rootProject.buildScan
doFirst {
ClassLoader classLoader = task.getClass().classLoader
while (classLoader instanceof URLClassLoader) {
def fingerprints = [] as Set
def allFiles = [] as Set
classLoader.getURLs().each {
@gabrielfeo
gabrielfeo / pinentry-op.bash
Last active February 20, 2025 17:06
Have gpg fetch key password using 1Password CLI
#!/usr/bin/env bash
# Have gpg fetch key password using 1Password CLI.
#
# 1. Add to ~/.gnupg/gpg-agent.conf:
#
# pinentry-program <path to this file>
#
# 2. Export OP_GPG_PASSWORD_ENTRY_<key-id>=<key-password-reference> variables :
#
@gabrielfeo
gabrielfeo / download-deec-assets.py
Last active January 24, 2025 19:20
A script to download assets from an unintuitive University Of Coimbra file-hosting website.
#!/usr/bin/env python3
'''
Downloads requested assets based on a JSON file that lists a directory tree.
USAGE:
./download-deec-assets.py --json-file deec-assets.json --dir-name '[E2]Eletronica_2'
# or
./download-deec-assets.py --json-file deec-assets.json --dir-id '0fx80'
@gabrielfeo
gabrielfeo / cashapp_gradle_enterprise.gradle
Created January 22, 2025 16:02 — forked from jrodbx/cashapp_gradle_enterprise.gradle
Example Gradle Enterprise config
import groovy.json.JsonSlurper
import static java.nio.charset.Charset.defaultCharset
import static java.util.concurrent.TimeUnit.SECONDS
// Captures build and environment data and stores it in build scans via custom tags, links,
// and values, for one-off and trend analyses.
gradleEnterprise {
buildScan {
@gabrielfeo
gabrielfeo / add-relative-symlinks.py
Last active November 22, 2024 14:15
Adds relative symlinks in the given directory, pointing to the specified files in the current directory. Useful to add symlinks to a nested Gradle build in order to open it separately in an IntelliJ IDE (but prefer making it an included build)
@gabrielfeo
gabrielfeo / randomize-remote-cache-path.init.gradle
Created October 14, 2024 11:45
Randomize Gradle remote cache path for benchmarking upload performance
// Randomizes the cache path so that builds always miss and push cache entries
// to the remote cache. Used to benchmark upload performance when making changes
// to a Develocity instance. Configuration cache must be disabled so that
// a random path is never re-used.
settingsEvaluated { settings ->
settings.with {
// This impl will only work with the Develocity build cache type
assert buildCache.remote.class.name.contains('com.gradle.develocity')
buildCache.remote.path = "cache/${UUID.randomUUID()}"
@gabrielfeo
gabrielfeo / http-bench-tools-sorted.txt
Last active July 11, 2024 14:24
HTTP benchmarking tools from denji/awesome-http-benchmark, sorted by stars
https://github.com/wg/wrk
https://github.com/loadimpact/k6
https://github.com/tsenart/vegeta
https://github.com/rakyll/hey
https://github.com/ddosify/ddosify
https://github.com/mcollina/autocannon
https://github.com/codesenberg/bombardier
https://github.com/hatoo/oha
https://github.com/giltene/wrk2
https://github.com/six-ddc/plow
@gabrielfeo
gabrielfeo / releases-to-changelog.py
Created April 5, 2024 03:03
releases-to-changelog
#!/usr/bin/env python3
# Small script to build a changelog file out of past GitHub releases.
#
# USAGE: ./releases-to-changelog.py <github-repo-path>
# Example: ./releases-to-changelog.py "JetBrains/kotlin" > CHANGELOG.md
from subprocess import check_output
import sys
import json