Skip to content

Instantly share code, notes, and snippets.

@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:
@gabrielfeo
gabrielfeo / log-init-scripts.groovy
Last active April 11, 2022 10:46
Log all init script in a Gradle build. Paste in ~/.gradle/init.gradle to inspect IDE-injected init scripts.
import java.time.LocalDateTime
rootProject {
def time = LocalDateTime.now().toString()
def log = new File("${projectDir}/init-scripts-${time}.log")
log.write "${time}\n"
log << gradle.startParameter.currentDir.path
<< '\nInit scripts:\n---------\n\n'
gradle.startParameter.allInitScripts.each { file ->
@gabrielfeo
gabrielfeo / add_mpl_header.py
Last active March 29, 2022 21:20
Add the Mozilla Public License (MPL) v2.0 header to every source file in a directory. Apache's license-eye does this already, but its formatting of comments isn't perfect, e.g. no newline after the header comment.
#!/usr/bin/env python3
from collections import namedtuple
from ctypes import Union
import os
import argparse
from fileinput import FileInput
import textwrap
parser = argparse.ArgumentParser()