Skip to content

Instantly share code, notes, and snippets.

@gabrielfeo
gabrielfeo / add-relative-symlinks.py
Last active October 29, 2024 21:10
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
@gabrielfeo
gabrielfeo / touch-id-for-sudo.sh
Last active June 2, 2023 18:29
Add touch ID as valid authentication for sudo on macOS
awk '!/^#/ && !p { print "auth sufficient pam_tid.so"; p=1 }1' /etc/pam.d/sudo \
| tee ./temp-pamd \
&& read \
&& sudo mv ./temp-pamd /etc/pam.d/sudo
&& rm ./temp-pamd
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gabrielfeo
gabrielfeo / craft-asset-fix.py
Created May 1, 2023 02:14
Craft attachment import fix
#!/usr/bin/env python3
import shutil
import argparse
from pathlib import Path
from urllib.parse import quote
def prefix_assets(dir_path):
for assets_dir in dir_path.rglob("*.assets"):
@gabrielfeo
gabrielfeo / ggdsl_datetime_errors_javatime.ipynb
Last active April 4, 2023 18:01
Kotlin ggdsl errors with datetime APIs. Don't use java.time. Don't use kotlinx.time LocalDate or LocalDateTime. Do use kotlinx.datetime.Instant.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gabrielfeo
gabrielfeo / check-inconsistent-versions.init.gradle.kts
Created February 24, 2023 20:19
check-inconsistent-versions.init.gradle.kts
/**
* Checks for inconsistent versions in project dependencies.
* USAGE:
* ./gradlew help --init-script check-inconsistent-versions.init.gradle.kts
*
*
* For example, a project using Okio 3.0.0 in production, but 3.3.0 in tests:
*
* project ':': inconsistencies found
* com.squareup.okio:okio: