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 / groovySplitVsTokenize.groovy
Last active November 28, 2020 07:55
Groovy String split() vs tokenize() #groovy
final List TestCases = [
'/usr/bin/sh',
'//usr/bin/sh',
'usr//bin/sh',
'usr//bin//sh///',
'//',
'/',
' / ',
' // ',
' ',
@turboBasic
turboBasic / expand-variables-in-file.md
Last active November 28, 2020 03:53
Expand variables in text read from file #bash

Expand variables in text read from file

$ printf '%s\n' 'Hi, $name! Today is $day...' > something.txt

$ name=Andriy day=Friday  . <(echo -e echo $( < something.txt ))

Hi, Andriy! Today is Friday...
@turboBasic
turboBasic / BaseObjectDescription.groovy
Last active November 7, 2021 17:06
Use static factory to dynamically change behavior of interface #groovy #design-pattern
package xyz.bebee.example.groovy
/**
* Implements bare minimum description of object
*/
class BaseObjectDescription implements ObjectDescription {
final def object
BaseObjectDescription(def object) {
@turboBasic
turboBasic / ignore_moves.py
Last active October 27, 2020 18:14
Show diff and ignore line moves #git #diff
#!/usr/bin/python
import sys
from itertools import *
RED = 31
GREEN = 32
RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[0;%dm"
@turboBasic
turboBasic / jenkins-cli-authorize-by-api-key.sh
Created October 7, 2020 00:42
Jenkins CLI authorize using API kiey #jenkins
#!/bin/sh
###
java -jar ~/.local/bin/jenkins-cli.jar \
-s https://jenkins-example.com/ \
-auth $LOGN:$JJACK_PSW \
list-credentials \
system::system::jenkins
@turboBasic
turboBasic / dsl-script-use-latest-patchset.md
Last active October 7, 2020 00:36
Jenkins DSL script to build job from latest Gerrit patchset #jenkins #gerrit

Jenkins DSL script to build job from latest Gerrit patchset

Job configuration

Parameters

CHANGE_NUMBER (String)
@turboBasic
turboBasic / decrypt-credentials-xml.md
Last active October 6, 2020 20:53
Jenkins decrypt credentials.xml on master

Decrypt text saved in .xml on Jenkins master

println( 
    hudson.util.Secret.decrypt(
        "{AQAAABAAAAAw...............................................................Zn7HayNA==}"
    ) 
)
@turboBasic
turboBasic / create-config-provider-object.md
Last active September 21, 2020 23:07
Create config provider object on master using Job DSL script #jenkins #job-dsl

Create config-provider object using Job DSL

configFiles {
    propertiesConfig {
        id 'conf-0100-properties'
        name 'created-by-dsl-properties'
        content '''
 GIT.COMMITTER_NAME = name
@turboBasic
turboBasic / sed cheatsheet
Created September 20, 2020 18:54 — forked from ssstonebraker/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@turboBasic
turboBasic / change-commit-author.sh
Last active September 19, 2020 17:59
Selectively change author of N last commits #git
#/bin/sh
git rebase --interactive --root -x "git commit --amend --author 'turboBasic ⚡💀⚡ <off@boun.cr>' --no-edit"