Skip to content

Instantly share code, notes, and snippets.

View mpetuska's full-sized avatar
🇪🇺

Martynas Petuška mpetuska

🇪🇺
View GitHub Profile
@mpetuska
mpetuska / JSObj.kt
Created October 14, 2021 10:49
Fluent Kotlin DSL for building JSON trees
@DslMarker
annotation class JSBuilderDsl
@DslMarker
annotation class JSSetterDsl
data class JSObj(val map: MutableMap<String, Any?> = mutableMapOf()) : MutableMap<String, Any?> by map {
object Arr {
@JSBuilderDsl
operator fun get(vararg items: Any?) = items
@mpetuska
mpetuska / README.md
Last active January 8, 2022 17:58
Utility script to find and run the nearest gradle wrapper.

Installation

  1. Download the raw script: curl -o ~/.local/bin/gradlew https://gist.githubusercontent.com/mpetuska/86c05e02b2199e5a2f186da0c2c3f2fd/raw/gradlew.sh
  2. Adjust permissions: chmod +x ~/.local/bin/gradlew
  3. (Optional) Make a shortcut: ln -s ~/.local/bin/gradlew ~/.local/bin/gw

There's also an installation script available:

curl https://gist.githubusercontent.com/mpetuska/86c05e02b2199e5a2f186da0c2c3f2fd/raw/installGW.sh | bash
@mrk-han
mrk-han / emulator-install-using-avdmanager.md
Last active June 18, 2024 07:51
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For an emulator that mimics a Pixel 5 Device with Google APIs and ARM architecture (for an M1/M2 Macbook):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-30;google_atd;arm64-v8a"

@jeroenr
jeroenr / logback.xml
Created July 25, 2017 19:42
Logback configuration splitting to stdout and stderr
<configuration>
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
<target>System.err</target>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active July 2, 2024 14:42
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
eval "$(ssh-agent -s)"