Skip to content

Instantly share code, notes, and snippets.

View bbl's full-sized avatar

Bogdan bbl

View GitHub Profile
@bbl
bbl / SYSTEMD.md
Created December 29, 2017 09:23
Tips for systemd

Verify you .service file

systemd-analyze verify /path/to/your/file.service
@bbl
bbl / Bash_at_exit_command.md
Last active December 20, 2018 21:23
Bash run command at exit

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"
@bbl
bbl / Installation.md
Last active December 20, 2018 21:22
Install docker and docker compose on Ubuntu

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
@bbl
bbl / simple_backup.sh
Last active September 30, 2018 18:34
Example script for "Consul - the swiss knife by Hashicorp" article.
#!/usr/bin/env bash
function perform_backup(){
echo -n "Copying some stuff on S3.."
echo "Done!"
}
perform_backup
@bbl
bbl / install_consul_linux.md
Last active January 13, 2019 09:13
Intall Consul on Linux [Ubuntu, Debian, CentOS]

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.

#!/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}
}
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
"""
@bbl
bbl / openshift_kubelet_logs.md
Last active January 18, 2019 09:11
Openshift Kubelet Logs

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:
@bbl
bbl / golang_inspect_strcut.md
Created January 18, 2019 09:10
Inspect struct object golang

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

fmt.Println(fmt.Sprintf("%+v", myStruct))
@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: