Skip to content

Instantly share code, notes, and snippets.

View revilon1991's full-sized avatar
🐈
work hard, play hard

Evgenii Kuznetsov revilon1991

🐈
work hard, play hard
View GitHub Profile
@revilon1991
revilon1991 / profile.sh
Created July 6, 2025 11:13
Find a ip's a local server by mac address
findMinix() {
local subnet="192.168.2"
local enp1s0_mac="a0:1e:0b:0e:81:14"
local wlan0_mac="cc:4b:73:8e:6c:8a"
normalize_mac_simple() {
echo "$1" | tr '[:upper:]' '[:lower:]' | awk -F: '{
for(i=1;i<=NF;i++) {
sub(/^0+/, "", $i);
printf "%s%s", $i, (i==NF ? "\n" : ":")
@revilon1991
revilon1991 / init.lua
Created June 29, 2025 08:03
switch between mac apps by hotkeys
-- Install https://github.com/Hammerspoon/hammerspoon and put this in ~/.hammerspoon/init.lua
ctrlCmdShortcuts = {
{"]", "PhpStorm"},
{"[", "GoLand"},
{"'", "Spotify"},
{"/", "Safari"},
{"\\", "Slack"},
}
for i,shortcut in ipairs(ctrlCmdShortcuts) do

What is a Page Split and Its Impact on Database Fragmentation

A Page Split occurs in B-trees (the underlying structure of most database indexes) when a new record is inserted into a full data page. To make room, the database engine splits the page into two, redistributes the records, and updates the index pointers.

Why Does a Page Split Cause Fragmentation?

  1. Breaks Physical Order – The new page may be allocated in a different location, disrupting the sequential structure of the data.
  2. Extra Redistribution Costs – Each split requires modifying adjacent pages and potentially updating parent nodes, increasing system load.
  3. Decreased Read Efficiency – Fragmentation forces the database to perform additional I/O operations when reading sequential data.
@revilon1991
revilon1991 / goroutines.go
Created October 13, 2024 07:09
Golang API, WaitGroup, Semaphore, Cancel Context, Recovery Panic, Safe Map Mutex Result goroutine
package main
import (
"context"
"encoding/json"
"fmt"
"net/http"
"runtime/debug"
"strconv"
"sync"
@revilon1991
revilon1991 / gcal_countries.py
Last active July 3, 2024 13:32 — forked from seanblanchfield/gcal_countries.py
Google calendar public holiday names by country
# Complete mapping of ISO 3166 2-letter country codes to descriptions used in Google calendar URLs, accurate as of 29 July 2021.
iso_to_gcal_description = {
"ad": "ad",
"ae": "ae",
"af": "af",
"ag": "ag",
"ai": "ai",
"al": "al",
"am": "am",
# Majority Grouping
select concat(repeat('*', floor(a.trCount / 100))) as bar,
floor(avg(a.trCount)) as avgTrCnt,
max(a.trCount) as maxTrCnt,
min(a.trCount) as minTrCnt,
count(*) as accountCnt
from Account a
where 1
and a.trCount > 10
group by bar
@revilon1991
revilon1991 / mysql_lock.md
Last active March 23, 2025 14:05
MySQL InnoDB synthetic lock

Совместимость типов блокировок на уровне таблицы представлена в следующей матрице

X IX S IS
X Конфликт Конфликт Конфликт Конфликт
IX Конфликт Совместимо Конфликт Совместимо
S Конфликт Конфликт Совместимо Совместимо
IS Конфликт Совместимо Совместимо Совместимо
  • S-блокировка позволяет транзакции, которая удерживает блокировку, читать строку.
  • X-блокировка позволяет транзакции, которая удерживает блокировку, обновлять или удалять строку.
@revilon1991
revilon1991 / AppController.php
Created January 9, 2023 20:06
CRUD symfony form with ManyToMany relations
<?php
declare(strict_types=1);
namespace App\Controller;
use App\Entity\Article;
use App\Entity\ArticleHasTag;
use App\Entity\Tag;
use Doctrine\Common\Collections\ArrayCollection;
@revilon1991
revilon1991 / restartTouchPad.sh
Last active September 2, 2022 15:36
When you macbook tuchpad is broken and does'nt work multi touch
launchctl stop com.apple.Dock.agent
<?php
// here installed https://github.com/dragonmantank/cron-expression
require_once '/Users/ekuznetsov/projects/pamyatki/vendor/autoload.php';
// current time is 2022-08-18 18:30:30
date_default_timezone_set('Europe/Moscow');
$c = new \Cron\CronExpression('0 0 1 * *');