Skip to content

Instantly share code, notes, and snippets.

View bbl's full-sized avatar

Bogdan bbl

View GitHub Profile
@bbl
bbl / Makefile
Created June 13, 2020 12:17
Get Makefile root directory absolute path
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
test:
@echo $(ROOT_DIR)
apiVersion: v1
kind: Pod
metadata:
name: simulation-manager
labels:
run: simulation-manager
spec:
containers:
- name: simulation-manager
image: resoptima/simulation-manager
@bbl
bbl / Makefile
Created October 17, 2019 09:03
Makefile list targets by default
.DEFAULT_GOAL := list
PHONY: list
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^ [:alnum:]]' -e '^$@$$'
@bbl
bbl / bash_check_environmnent_variable.md
Created October 12, 2019 15:56
Check environment variable in bash
: ${SUB_ZERO:?"Need to set SUB_ZERO non-empty"}
@bbl
bbl / openshift_helm.sh
Last active September 29, 2019 17:31
Install Helm on Openshift
#!/usr/bin/env bash
set -euo pipefail
: ${HELM_VERSION:?"Need to set HELM_VERSION non-empty"}
: "${TILLER_NAMESPACE:=tiller}"
oc new-project ${TILLER_NAMESPACE}
@bbl
bbl / jenkins_scritpted_cron_trigger.groovy
Created September 24, 2019 07:37
Jenkins scripted pipeline: cron trigger
node {
properties ([pipelineTriggers([cron('0 0 * * *')])])
stage('Clone repositories') {
sh 'echo test'
}
}
@bbl
bbl / parse_json_yaml_to_map.go
Created September 14, 2019 08:22
GoLang: Parse json yaml to map[string]interface{}
func main() {
jsonStr := `{"isSchemaConforming":true,"schemaVersion":0,"unknown.0":[{"email_address":"test1@uber.com"},{"email_address":"test2@uber.com"}]}`
dynamic := make(map[string]interface{})
json.Unmarshal([]byte(jsonStr), &dynamic)
}
@bbl
bbl / source_script_directory.md
Created August 22, 2019 12:33
Bash get script directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
@bbl
bbl / make_variable_check.md
Created July 13, 2019 12:10
Makefile check if variable is defined

Check if variable is defined in a Makefile

Using ifndef

ifndef MY_FLAG
$(error MY_FLAG is not set)
endif
@bbl
bbl / vault_certificate_error.md
Created January 24, 2019 08:20
Vault error x509: certificate signed by unknown authority
$ vault status
Error checking seal status: Get https://172.16.4.117:8200/v1/sys/seal-status: x509: certificate signed by unknown authority

Solution: