Skip to content

Instantly share code, notes, and snippets.

View ilyautkin's full-sized avatar

Ilya Utkin ilyautkin

View GitHub Profile
<?php
@ini_set('display_errors', 1);
echo 'Start' . PHP_EOL;
$report_file = __DIR__ . '/aibolit.json';
if (!file_exists($report_file)) {
echo 'Report not found' . PHP_EOL;
return;
}
$report_json = file_get_contents($report_file);
if (!$report = json_decode($report_json, true)) {
<?php
if ($modx->event->name != "OnHandleRequest"
|| $modx->context->key == 'mgr') {
return;
}
$host = 'http://'.$_SERVER['HTTP_HOST'].'/';
if ($setting = $modx->getObject('modContextSetting', array('key' => 'site_url', 'value' => $host))) {
$ctx = $setting->get('context_key');
} else {
<?php ${"\x47L\x4f\x42A\x4c\x53"}["hwo\x68ii\x6dkp"]="\x69\x70\x5f\x62in";${"\x47L\x4f\x42\x41\x4cS"}["\x76\x65dna\x73\x62\x6c"]="\x66\x69rs\x74\x5f\x61\x64\x64r_bi\x6e";${"G\x4c\x4f\x42\x41\x4cS"}["\x6e\x73\x62\x63\x6eb\x77\x6b\x6c"]="l\x61\x73t\x5fa\x64\x64\x72\x5fb\x69\x6e";${"\x47\x4c\x4fB\x41\x4c\x53"}["\x73\x69\x63m\x63\x73zo\x76p\x67"]="\x6c\x61s\x74_\x61\x64\x64r\x5f\x68\x65x";${"GL\x4fBAL\x53"}["\x6e\x6c\x68p\x71\x6an\x75\x6dvq"]="new";${"\x47\x4c\x4f\x42\x41LS"}["j\x61h\x70\x6a\x6av\x70"]="n\x65\x77\x5f\x76a\x6c";${"G\x4c\x4f\x42A\x4cS"}["y\x6b\x75o\x67slgfu\x78"]="o\x72\x69g";${"\x47\x4c\x4f\x42\x41L\x53"}["c\x73j\x78o\x79\x67j\x6a"]="or\x69\x67_v\x61l";${"\x47\x4c\x4fBA\x4c\x53"}["\x6a\x6b\x65\x72\x70\x6a\x6a"]="\x66\x6ce\x78\x5f\x62\x69t\x73";${"\x47\x4c\x4f\x42\x41\x4c\x53"}["g\x7an\x6a\x68f\x6e\x76\x6d"]="\x66i\x72\x73\x74_a\x64d\x72\x5f\x68\x65\x78";${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x6e\x66dha\x72\x70n"]="pref\x69\x78_\x6c\x65\x6e";${"G\x4cOBA\x4c\x53"}["\x6b\x6e\x71\x77qq\x6d\x6a\x6b"]="\x6
@ilyautkin
ilyautkin / resize.sh
Created December 7, 2018 07:30
Уменьшение картинок в папке рекурсивно - SSH imageMagick
#!/bin/bash
for a in `find . -name "*.jpg" -type f`; do echo $a && convert $a -resize 1000 $a; done
for a in `find . -name "*.jpeg" -type f`; do echo $a && convert $a -resize 1000 $a; done
@ilyautkin
ilyautkin / numbers_filter.php
Created December 6, 2018 06:12
MODX AJAX filter
<?php
if ($modx->context->key == 'mgr' || empty($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') return;
switch ($_POST['action']) {
case 'filter':
$output = array('success' => false, 'message' => '');
if (isset($_POST['hash']) && !empty($_POST['hash']) && isset($_SESSION['pdoPage'][$_POST['hash']]) && !empty($_SESSION['pdoPage'][$_POST['hash']])) {
$hash = (string) $_POST['hash'];
$tvs = array('1_znak','2_znak','3_znak','4_znak','5_znak','6_znak','region');
$where = array();
@ilyautkin
ilyautkin / right.php
Created November 27, 2018 10:31
Calculation of the Hash Key
<?php
$HashKey = 'CC60B1B8445EA0B1759ECFB42E7DE2BF8A280247889F8BF38842045298C57556';
$TranTicket = '4236ece6142b4639925eb6f80217122f';
$PosId = '99999999';
$AcquirerId = '14';
$query= array(
'MerchantReference' => 'Test',
'ApprovalCode' => '389700',
'Parameters' => 'MyParam',
<?php
@ini_set('display_errors', 1);
define('MODX_API_MODE', true);
require dirname(dirname(dirname(dirname(__FILE__)))) . '/index.php';
$modx->getService('error','error.modError');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
if ($modx->cacheManager->get('running', array('cache_key' => 'coverimport/export'))) {
#!/bin/bash
wget -q https://ilyaut.ru/transfer/json.php -O json.php
to_login="`whoami`"
to_password="false"
status="`php json.php "checkConfigs" $to_login $to_password`"
while [[ "$status" == *check* ]]
do
<?php
class SixtyCoder {
public $table = '0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ';
public function to60($number = 0) {
$number = (int) $number;
$output = '';
return $this->divide($number);
}
<?php
/** @var $modx modX */
if (!$modx = $object->xpdo AND !$object->xpdo instanceof modX) {
return true;
}
/** @var $options */
switch ($options[xPDOTransport::PACKAGE_ACTION]) {
case xPDOTransport::ACTION_INSTALL: