Skip to content

Instantly share code, notes, and snippets.

View turboBasic's full-sized avatar
🔮
Focusing

andriy melnyk turboBasic

🔮
Focusing
View GitHub Profile
@turboBasic
turboBasic / class-as-container-for-constants.md
Last active September 14, 2021 15:33
How to manage constants in Java/Groovy #java #groovy

Class as constants container

final class Constants {
    final class File {
        public static final int MIN_ROWS = 1
        public static final int MAX_ROWS = 1000
        private File() {}
 }
@turboBasic
turboBasic / Inspect.groovy
Last active August 16, 2021 22:21
class Inspect for inspecting big objects in Groovy #groovy
import groovy.json.JsonGenerator
import groovy.json.JsonOutput
/**
* Inspects big objects
* Usage:
* println Inspect.unwrapAsJsonWithProperties(sourceSets, 3)
* println Inspect.unwrapAsJsonWithProperties(sourceSets.main.allSource, 2, 150)
* println Inspect.unwrapAsJson(sourceSets.main, 2, 120)
*/
@turboBasic
turboBasic / build.gradle
Last active August 15, 2021 10:59
Gradle task `printSourceSets` #gradle
plugins {
id 'groovy'
}
sourceSets {
// ...
}
@turboBasic
turboBasic / GroovyProcess.md
Last active August 3, 2021 10:27
Execute long process and collect stdout and stderr in #groovy

Execute long process and collect stdout and stderr

Recipe 1

    def command = """
 java -Xms512m -Xmx1024m \
@turboBasic
turboBasic / # ansible recipes.md
Last active July 20, 2021 06:40
Ansible recipes #ansible

Ansible recipes

This document contains unstructured list of Ansible recipes

Output facts about your host

ansible --module-name setup --connection local $(hostname)

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@turboBasic
turboBasic / #helpers for Lastpass CLI client (lpass).md
Last active June 20, 2021 15:57
create Lastpass groups and items using CLI client

Helpers for Lastpass CLI client (lpass)

Wrap operations related to creation of accounts in nested Lastpass folders (groups). Those operations have always been tricky in lpass because of cumbersome path separator (\) and shell escaping rules

lpass-add

Creates item with complex path eg. Folder1\Folder2/item.name. Creates parent folder objects if required.

@turboBasic
turboBasic / updateConfluencePage.py
Last active June 2, 2022 20:59
Update Confluence page #confluence #atlassian #rest
#!/usr/bin/env python3
# $ python write_page.py -h
# usage: write_page.py [-h] [-u USER] [-t TITLE] [-f FILE] pageid [html]
# positional arguments:
# pageid Specify the Conflunce page id to overwrite
# html Write the immediate html string to confluence page
# optional arguments:
# -h, --help show this help message and exit
# -u USER, --user USER Specify the username to log into Confluence
@turboBasic
turboBasic / createReusableParameters.groovy
Last active November 2, 2022 06:51
Create reusable parameter definitions in Job DSL script #jenkins #job-dsl
// taken from https://groups.google.com/g/job-dsl-plugin/c/eJvX7G7OwQU?pli=1
def aParam = {
stringParam('aa')
}
def moreParams = {
stringParam('bb')
stringParam('cc')
}
@turboBasic
turboBasic / #ansi 256 colors chart.md
Last active February 21, 2021 08:50
Ansi 256 colors chart #pocket #ansi #color