Skip to content

Instantly share code, notes, and snippets.

Avatar

Pierrick Greze pgreze

View GitHub Profile
@pgreze
pgreze / secret.main.kts
Last active Jun 10, 2021
Google Secret Manager with Kotlin
View secret.main.kts
@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
About Gradle and memory declaration
View gradle-memory.md

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 / config.yml
Last active Apr 19, 2021
Flank presentation
View config.yml
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 / run.main.kts
Created Mar 16, 2021
Allow to run multiple actions on demand in Kotlin script
View run.main.kts
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 Oct 16, 2020
Google Cloud Function allowing to expose private resources if accessed from a secured network
View .gcloudignore
# 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
@pgreze
pgreze / args.py
Created Oct 6, 2020
Provide all remaining bash arguments to a subscript
View args.py
import sys
print(sys.argv)
@pgreze
pgreze / devices.txt
Created Sep 9, 2020
Test Lab Available devices
View devices.txt
┌───────────────────┬────────────────────┬──────────────────────────────────────┬──────────┬─────────────┬──────────────────────┬─────────────────────────────────────────────┐
│ MODEL_ID │ MAKE │ MODEL_NAME │ FORM │ RESOLUTION │ OS_VERSION_IDS │ TAGS │
├───────────────────┼────────────────────┼──────────────────────────────────────┼──────────┼─────────────┼──────────────────────┼─────────────────────────────────────────────┤
│ 602SO │ Sony │ Sony XZs │ PHYSICAL │ 1920 x 1080 │ 26 │ │
│ 801SO │ Sony │ Sony XZ3 801SO │ PHYSICAL │ 2880 x 1440 │ 28 │ │
│ A0001 │ OnePlus │ OnePlus One │ PHYSICAL │ 1920 x 1080 │ 22 │
@pgreze
pgreze / git.diff
Created Apr 27, 2020
Force ANDROID SDK in gradlew
View git.diff
diff --git a/gradle/android-studio-paths.sh b/gradle/android-studio-paths.sh
new file mode 100644
index 0000000..ae3d1e0
--- /dev/null
+++ b/gradle/android-studio-paths.sh
@@ -0,0 +1,51 @@
+#
+# In order to avoid "Daemon could not be reused" when using command line and Android Studio,
+# this is forcing the JAVA_HOME by looking at common places for Android Studio installations.
+#
@pgreze
pgreze / sdkman.sh
Last active Apr 14, 2020
Install Kscript on Linux with sdkman
View sdkman.sh
# Install sdkman
curl -s https://get.sdkman.io | bash # 2s
source "$HOME/.sdkman/bin/sdkman-init.sh"
# Install kotlin and kscript
sdk install kotlin # 10s ...
sdk install kscript # 6s
@pgreze
pgreze / detekt.html
Created Apr 6, 2020
Detekt build/reports/detekt/ examples
View detekt.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>detekt report</title>
<style>
h2 {
background-color: #666666;
padding: 0.2em;
color: #ffffff;