Skip to content

Instantly share code, notes, and snippets.

View MakStashkevich's full-sized avatar
🍀
believe on the best

Maksim Stashkevich MakStashkevich

🍀
believe on the best
View GitHub Profile
@MakStashkevich
MakStashkevich / ThreadPool.py
Created March 27, 2022 07:56 — forked from JevinJ/ThreadPool.py
An Interruptible/Pausable thread pool in python, KeyboardInterrupt will stop the pool, KeyboardInterrupt can be caught to start the pool where it left off.
import queue
import threading
import os
import time
import signal
class Worker(threading.Thread):
def __init__(self, tasks, results):
super().__init__()
self.tasks = tasks
@MakStashkevich
MakStashkevich / start.sh
Last active November 12, 2020 10:02
Start loader server from folder (to PocketMine-MP cores)
#!/usr/bin/env bash
DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
cd "$DIR"
while getopts "p:f:l" OPTION 2> /dev/null; do
case ${OPTION} in
p)
PHP_BINARY="$OPTARG"
;;
f)
@MakStashkevich
MakStashkevich / geometry_v1.12.0.json
Created September 6, 2020 09:22
Geometry v1.12.0
{
"format_version": "1.12.0",
"minecraft:geometry": [
{
"bones": [
{
"name": "body",
"parent": "waist",
"pivot": [
0,
@MakStashkevich
MakStashkevich / geometry_persona.json
Last active September 6, 2020 09:23
Geometry persona dump Minecraft v1.16.20 beta
{
"format_version": "1.14.0",
"minecraft:geometry": [
{
"bones": [
{
"locators": {
"armor_offset.default_neck": [
0,
24,
@MakStashkevich
MakStashkevich / centeringString.php
Created August 18, 2020 09:52
Centering multibyte string
<?php
/**
* Multibyte String Centering
*
* Сhanges the received strings centered relative to each other
*
* @param string $str1 The first string.
* @param string $str2 The second string.
* @param string $encoding The encoding to use, defaults to UTF-8.
@MakStashkevich
MakStashkevich / regexClearStrParse.php
Last active August 27, 2020 17:02
Clear text to use en\ru\uk\bel languages
<?php
$message = 'test^т е с т^456%:7?Ũ₦NⓃⓝўї中文'';
if (preg_match_all('/[' .
'\x{0041}-\x{005A}\x{0061}-\x{007A}' . // all english lang letters
'\x{0410}-\x{044F}\x{0451}\x{0401}' . // all russian lang letters (include Ё)
'\x{040E}\x{045E}' . // belorussian lang letters (ў)
'\x{0404}\x{0454}\x{0406}\x{0456}\x{0407}\x{0457}' . // all ukrainian lang letters (ї etc)
'\x{0020}-\x{0040}' . // other support symbols (#@$! etc) (include space)
'\x{005B}-\x{005F}' . // ASCII Punctuation
@MakStashkevich
MakStashkevich / StrParser.php
Created August 7, 2020 16:39
Bad code parse letters)))
<?php
final class StrParser
{
public const LETTER_A = 'A|Ⓐ|ⓐ|a|á|À|Â|à|Â|â|Ä|ä|Ã|ã|Å|å|α|Δ|Λ|λ|Ꭿ|∀|₳|Ǻ|ǻ|α|ά|Ǡ|Ắ|ắ|Ằ|ằ|ẳ|Ẵ|ẵ|Ä|ª|ä|Å|À|Á|Â|å|ã|â|à|á|Ã|ᗩ|@|Ⱥ|Ǟ';
public const LETTER_B = 'B|Ⓑ|ⓑ|b|ß|Β|β|ℬ|Ᏸ|β|฿|ß|Ђ|ᗷ|ᗽ|ᗾ|ᗿ|Ɓ|ƀ|ხ|␢|Ᏸ|ᗸ|ᗹ|ᛔ';
public const LETTER_C = 'C|Ⓒ|ⓒ|c|Ç|ç|¢|©|☾|ℭ|ℂ|Ç|¢|ç|Č|ċ|Ċ|ĉ|ς|Ĉ|ć|Ć|č|Ḉ|ḉ|⊂|Ꮸ|₡|¢|Ⴚ';
public const LETTER_D = 'd|Ⓓ|ⓓ|Þ|þ|Ð|ð|∂|ᗫ|Ɗ|Ď|ď|Đ|đ|ð|∂|₫|ȡ|ᚦ|ᚧ';
public const LETTER_E = 'E|Ⓔ|ⓔ|e|ℰ|ℯ|ໂ|६|£|Ē|℮|ē|Ė|ė|Ę|ě|Ě|ę|Έ|ê|ξ|Ê|È|€|É|∑|Ế|Ề|Ể|Ễ|é|è|عЄ|є|έ|ε|Ҿ|ҿ';
public const LETTER_F = 'F|Ⓕ|ⓕ|f|ƒ|ℱ|₣|ƒ|∮|Ḟ|ḟ|ჶ|ᶂ|φ|ᚨ|ᚩ|ᚪ|ᚫ';
@MakStashkevich
MakStashkevich / convertChunkToWorldXZ.php
Last active August 1, 2020 17:10
Convert chunk XZ to world XZ
<?php
$chunkX = -10;
$chunkZ = 10;
$minX = $chunkX << 4;
$maxX = $minX + 16;
$minZ = $chunkZ << 4;
$maxZ = $minZ + 16;
@MakStashkevich
MakStashkevich / romanNumeralConverter.php
Created August 1, 2020 15:45
Convert all numbers to Roman style
<?php
public function getRomanNumeral(int $integer): string
{
$romanNumeralConversionTable = [
'M' => 1000,
'CM' => 900,
'D' => 500,
'CD' => 400,
'C' => 100,
@MakStashkevich
MakStashkevich / PaintChunkXZ.php
Last active August 1, 2020 11:37
Paint min\max x\z on chunks
<?php
function paint($minX, $maxX, $minZ, $maxZ)
{
$fromX = $minX >> 4;
$toX = $maxX >> 4;
$fromZ = $minZ >> 4;
$toZ = $maxZ >> 4;