Skip to content

Instantly share code, notes, and snippets.

View CHIP0K's full-sized avatar
🏠
Working from home

Ihor CHIP0K

🏠
Working from home
View GitHub Profile
@CHIP0K
CHIP0K / mysql_to_json.sh
Last active August 15, 2025 11:03
shell_scripts
#!/usr/bin/env bash
##########
#
# If you have to convert a single table: set variable DB_TABLE=tablename
# If commenting DB_TABLE, this is a script to convert all tables in the database
#
##########
DB_DATABASE=dbname
@CHIP0K
CHIP0K / docker-compose.yml
Last active May 20, 2024 10:34
ELK stack
version: "3.9"
services:
setup:
image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
restart: always
volumes:
- /data/certs:/usr/share/elasticsearch/config/certs
user: "0"
command: >
#!/bin/bash
source /etc/environment
DEST_DUMP_PATH="/opt/backups/mysql"
DAYS=3
DUMP_NAME="$(hostname)_$(date +"%d-%m-%Y_%s")" # Get date in dd-mm-yyyy_s format
S3CMD=$(which s3cmd)
AWS=$(which aws)
AWS_S3_BUCKET="mysql-backups"
@CHIP0K
CHIP0K / docker-cleanup.sh
Created May 21, 2023 13:17
To clean the environment in the docker
#!/bin/bash
# Do not run if removal already in progress.
pgrep "docker rm" && exit 0
# Remove Dead and Exited containers.
docker rm $(docker ps -a | grep "Dead\|Exited" | awk '{print $1}'); true
# It will fail to remove images currently in use.
docker rmi $(docker images -qf dangling=true); true
@CHIP0K
CHIP0K / zfs_snapshot_rotate.sh
Last active August 31, 2023 07:47
MySQL Multi-Source Replication
#!/usr/bin/env bash
source /etc/environment
SNAPSHOT_TIME=$(date +'%Y-%m-%d_%H-%M-%S')
ROTATE_HOURS="24"
LOGFILE=/var/log/zfs.log
ZPOOL_NAME="zp_mysql"
ZFS_DATASET="mysql/data"
@CHIP0K
CHIP0K / README.md
Last active May 20, 2025 11:42
k3s cluster demo

K3s кластер deмо

Оточення

# master
k3s-node-fra1-01 pub_net: eth0:164.92.228.17 priv_net: eth1:10.114.0.97
# workers
k3s-node-fra1-02 pub_net: eth0:142.93.162.154 priv_net: eth1:10.114.0.94
k3s-node-fra1-03 pub_net: eth0:165.22.19.3 priv_net: eth1:10.114.0.95