Skip to content

Instantly share code, notes, and snippets.

View cherts's full-sized avatar

Mikhail Grigorev cherts

View GitHub Profile
@cherts
cherts / .bashrc
Created January 26, 2024 06:53
My .bachrc file
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# Default editor
export EDITOR=vim
# Enable programmable completion features (you don't need to enable
@cherts
cherts / uuidv7_native.py
Last active September 15, 2023 13:48
Native UUIDv7 on Python 3
import random
import time
import uuid
import datetime
# UUID v7 format:
# 0 1 2 3
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | unixts |
@cherts
cherts / change_group_id.sh
Last active October 2, 2023 11:07
Changing GID (gid>1000) to system (gid<1000)
#!/bin/bash
#
# Program: Changing GID (gid>1000) to system (gid<1000) <change_group_id.sh>
#
# Author: Mikhail Grigorev <sleuthhound at gmail dot com>
#
# Current Version: 1.0
#
# Revision History:
@cherts
cherts / nginx.conf
Created July 29, 2023 13:39
Nginx best config (base config) for Ubuntu
user nginx;
worker_processes auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 10000;
worker_shutdown_timeout 30;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# Для Linux 2.6+ - epool, Для FreeBSD - kqueue
@cherts
cherts / mysql_bash_template.sh
Last active August 4, 2025 12:12
MySQL bash template with logging and etc
#!/usr/bin/env bash
#
# Program: MySQL bash template with logging and etc <mysql_bash_template.sh>
#
# Author: Mikhail Grigorev <sleuthhound at gmail dot com>
#
# Current Version: 1.0
#
# Revision History:
@cherts
cherts / CodeMonk_Part#Man.sql
Created April 18, 2023 06:52 — forked from CodMonk/CodeMonk_Part#Man.sql
MySQL Stored Procedure for Table Partitioning
CREATE DEFINER=`root`@`localhost` PROCEDURE `Cmonk_partition_manager`(in partition_frequency varchar(100), in db_schema varchar(100),in input_table_name varchar(100), in partition_column varchar(100))
BEGIN
-- Author - Code Monk
-- Version - 1.0
-- Procedure for automated partitioning of table
-- Inputs :
-- 1- Partition_frequency : Options-(Daily,Monthly,Weekly)
-- 2- db_schema : Name of Database schema
-- 3- input_table_name : Table Name
@cherts
cherts / fast_run_netdata_in_docker.sh
Created March 3, 2023 14:03
Fast run Netdata in Docker
curl https://get.docker.com | bash
docker run -d --name=netdata \
-p 19999:19999 \
-v netdataconfig:/etc/netdata \
-v netdatalib:/var/lib/netdata \
-v netdatacache:/var/cache/netdata \
-v /etc/passwd:/host/etc/passwd:ro \
-v /etc/group:/host/etc/group:ro \
-v /proc:/host/proc:ro \
-v /sys:/host/sys:ro \
@cherts
cherts / tuned.conf
Last active March 3, 2023 13:11
Tuned profile for MySQL
apt-get -y install tuned
mkdir /etc/tuned/mysql
(cat<<-EOF
[main]
include=throughput-performance
summary=Tuned profile for MySQL Instances
[bootloader]
@cherts
cherts / disable-transparent-huge-pages.service
Last active February 14, 2023 16:08
Disable transparent huge page via systemd in Ubuntu/Debian
[Unit]
Description=Disable Transparent Huge Pages
Documentation=https://access.redhat.com/solutions/46111
[Service]
Type=oneshot
ExecStart=/bin/sh -c "/usr/bin/echo "never" | tee /sys/kernel/mm/transparent_hugepage/enabled"
ExecStart=/bin/sh -c "/usr/bin/echo "never" | tee /sys/kernel/mm/transparent_hugepage/defrag"
[Install]
@cherts
cherts / resize_disk.sh
Last active October 24, 2022 08:07
Resize LVM disk and partitions
#!/bin/bash
#
# Program: Resize LVM disk and partition <resize_disk.sh>
#
# Author: Mikhail Grigorev <sleuthhound at gmail dot com>
#
# Current Version: 1.0.2
#
# License: