Skip to content

Instantly share code, notes, and snippets.

View miholeus's full-sized avatar
💭
🤖

miholeus

💭
🤖
View GitHub Profile
@miholeus
miholeus / import_redis_keys.py
Created May 28, 2020 20:55
Import redis keys to another Redis server
import redis
from itertools import izip_longest
import sys
from multiprocessing import Pool
import signal
OLD = "SHARD_ENDPOINT_FOR_OLD_REDIS"
NEW = "SHARD_ENDPOINT_FOR_NEW_REDIS"
@miholeus
miholeus / big_integer.js
Created November 29, 2019 21:18
Douglas Crockford's big integer example for javascript
// big_integer.js
// Douglas Crockford
// 2019-02-09
// You can access the big integer object in your module by importing it.
// import big_integer from "./big_integer.js";
/*jslint bitwise */
/*property
@miholeus
miholeus / regex_test.php
Created April 6, 2019 18:13
regex yandex money
<?php
// responses in different formats
$r1 = "Пароль: 0188
Перевод на счет 41001312169904
Спишется 10,06р.
";
$r2 = "Пароль: 0188
Спишется 10,06р.
Перевод на счет 41001312169904
@miholeus
miholeus / modules.config.php
Created January 17, 2019 08:53
zf docflow config
<?php
<?php
/**
* Configuration file generated by ZF Apigility Admin
*
* The previous config file has been stored in /app/app/DocFlowServer/config/autoload/../../config/modules.config.old
*/
return [
'Zend\Filter',
'Zend\Hydrator',
@miholeus
miholeus / events.py
Last active September 28, 2022 05:53
event manager using python
# coding: utf-8
import copy
from collections import defaultdict
try:
import Queue as Q # ver. < 3.0
except ImportError:
import queue as Q
class Event(object):
@miholeus
miholeus / regex_route_trick.php
Created February 27, 2018 08:50
regex route
<?php
$regex = '#^(?|/foo(\d+)(*MARK:16)
|/foo(\w+)(*MARK:41)
)$#x';
preg_match($regex, '/footest', $matches);
var_dump($matches);
$m = $matches['MARK'];
$regex = substr_replace($regex, 'FAIL', $m, 5+strlen($m));
@miholeus
miholeus / quick_quiz.php
Created February 7, 2018 15:25
quick quiz
<?php
1.
$x = true;
if ($x == 1 && $x==2 && $x==3){
echo("ok");
}
2.
class Helm
{
@miholeus
miholeus / big_numbers.php
Created December 27, 2017 08:22
big numbers
<?php
$n1 = "1234534534534534534";
$n2 = "3435435435353464362";
// var_dump($n1+$n2);
function add($n1, $n2): string
{
// ищем максимальное по длине число
if (strlen($n1) > $n2) {
$max = $n1;
@miholeus
miholeus / data_integration.php
Created December 27, 2017 07:58
data integration example v2
<?php
namespace src\Integration;
class DataProvider
{
private $host;
private $user;
private $password;
/**
@miholeus
miholeus / data_integration.php
Created December 27, 2017 07:57
data integration example
<?php
namespace src\Integration;
class DataProvider
{
private $host;
private $user;
private $password;
/**