Skip to content

Instantly share code, notes, and snippets.

View mpetuska's full-sized avatar
🇪🇺

Martynas Petuška mpetuska

🇪🇺
View GitHub Profile
@mpetuska
mpetuska / README.md
Last active February 24, 2022 14:57
Script to sync milestone issues to the project

This script allows managing issue synchronisation between a github milestone and a project. Supports both, importing and clearing of milestone issues.

Usage

  1. Install kotlin (SDKMAN recommended): sdk install kotlin

  2. Install script

  3. wget https://gist.githubusercontent.com/mpetuska/7d2cab8500ba18d961e61e70d4c0a612/raw/ghImportMilestoneToProject.main.kts

    OR

@mpetuska
mpetuska / fixSSHPermissions.sh
Created November 17, 2021 21:53
Utility script to fix ssh permissions
#!/usr/bin/env bash
sudo chown -R $USER:$USER ~/.ssh
sudo chmod 700 ~/.ssh
sudo chmod 600 ~/.ssh/authorized_keys
sudo chmod 400 ~/.ssh/id_*
sudo chmod 644 ~/.ssh/id_*.pub
sudo chmod 600 ~/.ssh/known_hosts
@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 June 23, 2021 08:38
Script to convert a directory of files to a kotlin file with const vals of file contents

Description

A script to read all files in a given directory and convert their content to kotlin's const val file_name = """file content"""

Running

The script expects kotlinc to be on the path.

  1. Download the dirToKt.kts file
  2. Make it executable chmod +x dirToKt.kts
  3. Run is like any other script ./dirToKt.kts [targetDirectory] [outputFile]

Alternatively you could run it with kotlinc directly: kotlinc -script dirToKt.kts [targetDirectory] [outputFile]

@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
pool:
vmImage: 'ubuntu-latest'
trigger:
- master
pr:
- master
name: $(Rev:r)
parameters:
- name: disableSonarQube
parameters:
# Node
- name: workingDirectory
default: .
type: string
- name: packageManager
default: yarn
values:
- yarn
- npm
parameters:
- name: packageManager
default: yarn
values:
- yarn
- npm
- name: jfrogUser
- name: jfrogToken
- name: bundleDir
default: build/
parameters:
- name: workingDirectory
default: .
type: string
- name: jfrogUser
- name: jfrogToken
- name: imagesToPush
type: object
default: []
parameters:
- name: workingDirectory
default: .
type: string
- name: dockerGroup
default: ''
- name: tagLatest
default: true
- name: bundleDir
default: build/