Skip to content

Instantly share code, notes, and snippets.

Bogdan metallica127

Block or report user

Report or block metallica127

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@metallica127
metallica127 / Makefile
Created Oct 17, 2019
Makefile list targets by default
View Makefile
.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 '^$@$$'
@metallica127
metallica127 / bash_check_environmnent_variable.md
Created Oct 12, 2019
Check environment variable in bash
View bash_check_environmnent_variable.md
: ${SUB_ZERO:?"Need to set SUB_ZERO non-empty"}
@metallica127
metallica127 / openshift_helm.sh
Last active Sep 29, 2019
Install Helm on Openshift
View openshift_helm.sh
#!/usr/bin/env bash
set -euo pipefail
: ${HELM_VERSION:?"Need to set HELM_VERSION non-empty"}
: "${TILLER_NAMESPACE:=tiller}"
oc new-project ${TILLER_NAMESPACE}
@metallica127
metallica127 / jenkins_scritpted_cron_trigger.groovy
Created Sep 24, 2019
Jenkins scripted pipeline: cron trigger
View jenkins_scritpted_cron_trigger.groovy
node {
properties ([pipelineTriggers([cron('0 0 * * *')])])
stage('Clone repositories') {
sh 'echo test'
}
}
@metallica127
metallica127 / parse_json_yaml_to_map.go
Created Sep 14, 2019
GoLang: Parse json yaml to map[string]interface{}
View parse_json_yaml_to_map.go
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)
}
View source_script_directory.md
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
@metallica127
metallica127 / make_variable_check.md
Created Jul 13, 2019
Makefile check if variable is defined
View make_variable_check.md

Check if variable is defined in a Makefile

Using ifndef

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

Solution:

@metallica127
metallica127 / golang_inspect_strcut.md
Created Jan 18, 2019
Inspect struct object golang
View golang_inspect_strcut.md

To inspect the strcut you can use the %+v interpolation:

fmt.Println(fmt.Sprintf("%+v", myStruct))
View openshift_kubelet_logs.md

The kubelet in Openshift is run using hyperkube.
It is evaluated as a systemd service called origin-node.

  • To view the logs you can use:
$ journalctl -u origin-node
  • To check the status simply run:
You can’t perform that action at this time.