Skip to content

Instantly share code, notes, and snippets.

@zionyx
zionyx / README.md
Last active January 27, 2023 20:16
JavaScript to delete all inactive workflows in JIRA
@zionyx
zionyx / Auth-AzNpmFeed.ps1
Created March 10, 2022 16:58
This piece of PowerShell code helps to setup authentication info to Azure Artifact npm feed.
[CmdletBinding()]
param (
[String]$Registry,
[SecureString]$Token
)
$SampleRegistry = 'For example: //pkgs.dev.azure.com/project/npm/registry/'
function Validate-Registry {
param (
@zionyx
zionyx / github.groovy
Created March 17, 2020 11:13
GitHub JobDSL @Casz
private boolean isSandbox() {
def locationConfig = jenkins.model.JenkinsLocationConfiguration.get()
if (System.getenv("ENVIRONMENT") == "sandbox") {
true
} else if (locationConfig != null && locationConfig.getUrl() != null) {
locationConfig.getUrl().contains("staging")
} else {
false
}
}
@zionyx
zionyx / Jenkinsfile
Created January 17, 2022 13:45
Jenkinsfile gitversion docker image
// https://hub.docker.com/layers/gittools/gitversion/5.8.1-alpine.3.14-6.0-amd64/images/sha256-ca0a8c928333b55e976b8c1f7e33b34a9b0884598adad92be2d2e1234b9b28c2?context=explore
scripts {
def gitversionJson = sh label: 'Running GitVersion.', returnStdout: true, script: 'docker run --rm -v "$(pwd):/repo" gittools/gitversion:5.8.1-alpine.3.14-6.0-amd64 /repo'
try {
def gitversionMap = new groovy.json.JsonSlurperClassic().parseText(gitversionJson)
gitversionMap.each { k, v -> env["${prefix}${k}"] = "${v}" }
} catch (Exception ex) {
echo "GitVersion output: \n${gitversionJson}"
error ex.getMessage()
@zionyx
zionyx / sample-command-test.yaml
Last active October 6, 2021 18:09
Container Structure Test docker test on Windows with Linux containers command: `docker run -v //var/run/docker.sock:/var/run/docker.sock -v "$(pwd):/work" gcr.io/gcp-runtimes/container-structure-test:latest test -i ubuntu:latest -c /work/command-test.yaml`
schemaVersion: "2.0.0"
commandTests:
- name: "git cli"
command: "git"
args: ["--version"]
expectedOutput: ["git version 2.25.1"]
- name: "Check path"
command: "pwd"
# args:
# - -c
@zionyx
zionyx / gist:b604170fe14a40af2c41e27e750f1ee5
Last active August 18, 2021 07:23 — forked from jaturken/gist:3976117
Scala features cheatsheet

Scala Cheat Sheet

This cheat sheet originated from the forum, credits to Laurent Poulain. We copied it and changed or added a few things.

Evaluation Rules

  • Call by value: evaluates the function arguments before calling the function
  • Call by name: evaluates the function first, and then evaluates the arguments if need be

yUML Test On GitHub

yUML is a simple tool for embedding UML diagrams in wikis and blogs without needing any UML or diagramming tools.

Here's an idea of how it could be used in your repository readme.markdown or wiki.

View the RAW source to see how images are made.

Example markdown codes below

@zionyx
zionyx / Get-GitHubRepoSize.ps1
Created May 6, 2021 18:42
Get the size of a public github repository before downloading
# https://gist.github.com/dingzeyuli/f07c126b74371adba4b7dbe181cb57d2
# Tested on PowerShell-Core 7.1.3
If ( 'https://github.com/torvalds/linux.git' -match '([^/]+/[^/]+?)(?:\.git)' ) { Invoke-RestMethod "https://api.github.com/repos/$($Matches[1])" | Select-Object -Property size }
# Output: (in bytes)
# size
# ----
# 3262068
@zionyx
zionyx / MyTheme.psm1
Created July 22, 2020 07:36
My oh-my-posh theme
#requires -Version 2 -Modules posh-git
function Write-Theme {
param(
[bool]
$lastCommandFailed,
[string]
$with
)
@zionyx
zionyx / GitVersion.yml
Last active April 22, 2020 12:32
GitVersion.yml v2 - DEKA-717
# This property allows you to bump the next version explicitly. Also serves as base version.
# Uncomment to use. For more details: https://confluence.3shape.com/x/L44_C
#next-version:
# DEKA-817: Using standard GitVersion commit message to increment SemVer
# For complete instructions on how to use this, see https://confluence.3shape.com/x/00zfBw
commit-message-incrementing: Enabled
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'