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 / 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:

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:
@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))
@metallica127
metallica127 / install_consul_linux.md
Last active Jan 13, 2019
Intall Consul on Linux [Ubuntu, Debian, CentOS]
View install_consul_linux.md

Install consul on Linux

This snippet will help you to easily install consul on linux! Simply run the following:

curl -s -L https://git.io/fxJJR | sudo bash -s

The install_consul_linux.sh will be downloaded and evaluated.

View classifier.py
from sklearn import datasets
from sklearn import metrics
from sklearn.naive_bayes import GaussianNB
def get_iris_dataset():
"""
Get the iris data set using sklearn library
:return: Dictionary-like object
"""
View DOCKER_OVERLAY.md

Network

We need a global docker network in order to communicate between docker-compose setups on different hosts

Step 1: Install and run Consul (as a key-value storage for docker)

https://www.consul.io/intro/getting-started/install.html

Step 2: Edit docker configuration (on each docker host)

View SYSTEMD.md

Verify you .service file

systemd-analyze verify /path/to/your/file.service
@metallica127
metallica127 / Bash_at_exit_command.md
Last active Dec 20, 2018
Bash run command at exit
View Bash_at_exit_command.md

If set -e is set, non-zero exit code during script run will terminate the execution.
To prevent immidient termination and add some logic to cleanup stuff, you may need to use trap command:

#!/usr/bin/env bash

set -e

function cleanup {
  echo "Removing $TMP_STUFF_DIR"
@metallica127
metallica127 / Installation.md
Last active Dec 20, 2018
Install docker and docker compose on Ubuntu
View Installation.md

Lightweight script to install Docker CE and docker-compose on Ubuntu.

To run script simply execute:

curl https://gist.githubusercontent.com/metallica127/a6c1960502ae8ef61782f527eed1e343/raw/51cbf65b1fe1e213725822354ad16c479b928239/install_docker_compose.sh | sudo bash -s
View backup_with_lock.sh
#!/usr/bin/env bash
CONSUL_ADDR="${CONSUL_ADDR:-http://127.0.0.1:8500}"
function create_session(){
local session_id=$(curl -s -XPUT "${CONSUL_ADDR}/v1/session/create" \
-d "{\"Name\": \"backup\"}" | jq -r '.ID' )
echo ${session_id}
}
You can’t perform that action at this time.