Skip to content

Instantly share code, notes, and snippets.

View pgreze's full-sized avatar

Pierrick Greze pgreze

View GitHub Profile
@pgreze
pgreze / App.kt
Last active May 11, 2023 04:24
Showcase how adding an optional parameter without @jvmoverloads breaks a library API
package gradle.deps.conflicts
import com.github.pgreze.process.process
import kotlinx.coroutines.runBlocking
fun main() {
runBlocking {
// Notice it's missing the Charset argument introduced in kotlin-process 1.4,
// and it's only appearing when running the app:
//
@pgreze
pgreze / README.md
Last active February 18, 2023 01:19
Showcasing Github Actions workflow flatten hierarchy when using depth > 2
@pgreze
pgreze / config.yml
Last active February 7, 2023 23:36
Flank presentation
gcloud:
results-history-name: Flank for app_jp
timeout: 45m
record-video: true
use-orchestrator: true
test-targets:
- size large
environment-variables:
clearPackageData: true
device:
@pgreze
pgreze / args.sh
Created November 22, 2022 01:18
How to forward well bash arguments
$ cat args.sh
pargs() { echo "arg1=$1 arg2=$2"; }
pargs "$@"
pargs "$*"
$ sh ./args.sh "Hello world" haha
arg1=Hello world arg2=haha
arg1=Hello world haha arg2=
$ cat forward.sh
command() { echo "arg1=$1 arg2=$2"; }
@pgreze
pgreze / journey-extract-notes-from-sqlite.py
Created November 20, 2022 10:42
Extract notes from a journey.cloud sqlite database
'''Extract notes from a journey.cloud sqlite database.
First install journey.cloud on OSX,
locate the database files in folder
~/Library/Containers/com.journey.ios.app/Data/Library/Application\ Support/Journey/Journey.sqlite
and run this script with following arguments:
- the path to the sqlite database
- the directory to write notes into
'''
@pgreze
pgreze / app\build.gradle.kts
Created July 7, 2022 07:42
Gradle multi projects task dependencies
tasks.register("createResources") {
doLast {
println("Create resources")
}
}
afterEvaluate {
tasks.getByName("createResources")
.finalizedBy(":scripts:pushPr")
// > Task with name ':scripts:pushPr' not found in project ':app'.
//tasks.getByName(":scripts:pushPr")
@pgreze
pgreze / secret.main.kts
Last active June 10, 2021 02:13
Google Secret Manager with Kotlin
@file:DependsOn("com.google.cloud:google-cloud-secretmanager:1.6.2")
import com.google.api.gax.core.FixedCredentialsProvider
import com.google.api.gax.rpc.PermissionDeniedException
import com.google.auth.oauth2.ServiceAccountCredentials
import com.google.cloud.secretmanager.v1.AccessSecretVersionResponse
import com.google.cloud.secretmanager.v1.ProjectName
import com.google.cloud.secretmanager.v1.SecretManagerServiceClient
import com.google.cloud.secretmanager.v1.SecretManagerServiceSettings
import java.io.File
@pgreze
pgreze / gradle-memory.md
Last active May 27, 2021 09:33
About Gradle and memory declaration

From Gradle

About Configuring JVM memory:

The org.gradle.jvmargs Gradle property controls the VM running the build. It defaults to -Xmx512m "-XX:MaxMetaspaceSize=256m"

The JAVA_OPTS environment variable controls the command line client, which is only used to display console output. It defaults to -Xmx64m

But:

@pgreze
pgreze / run.main.kts
Created March 16, 2021 01:46
Allow to run multiple actions on demand in Kotlin script
import kotlin.Function0
import kotlin.Function1
import kotlin.Function2
import kotlin.Function3
import kotlin.Function4
import kotlin.Function5
import kotlin.system.exitProcess
fun run(
vararg functions: Pair<String, Function<Any>>,
@pgreze
pgreze / .gcloudignore
Last active October 16, 2020 08:31
Google Cloud Function allowing to expose private resources if accessed from a secured network
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files