This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (!function_exists('string_match')) { | |
| function string_match(string $haystack, string $needle, bool $inPosition = false) { | |
| $length = mb_strlen($haystack); | |
| for ($index = 0; $index < $length; $index++) { | |
| if (mb_substr($haystack, $index, 1) != mb_substr($needle, $index, 1)) { | |
| return $inPosition ? $index : ($index * 100 / $length); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function google_short_url(int $len = 7, string $prefix = '') { | |
| $short = $prefix; | |
| $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; | |
| $charslen = strlen($chars); | |
| for ($index=0; $index<$len; $index++) { | |
| $rnd = rand(0, $charslen); | |
| $short .= substr($chars, $rnd, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; Install to ~/.gimp/2.10/scripts | |
| (define (script-fu-hdr-from-lab inImage inLayer) | |
| (let* | |
| ( | |
| ; Define variables | |
| (copy 0) | |
| (copy2 0) | |
| (lightness 0) | |
| (lightness2 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function byte_convert($bytes, $format = null) { | |
| $base = 1024; | |
| $units = ['B', 'KB', 'MB', 'GB', 'TB']; | |
| if($format) { | |
| $format = mb_strtoupper($format, 'UTF-8'); | |
| $exp = array_search($format, $units); | |
| return round($bytes / pow($base, $exp)) . ' ' . $format; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| DIR="/home/boldyreva/Изображения/wallpapers/yandex" | |
| DATE=$(date +%Y-%m-%d) | |
| TIMESTAMP=$(date +%Y-%m-%d%t%H:%M:%S) | |
| URL="https://yandex.ru/images/today?size=1920x1200" | |
| FILENAME=${DIR}/Yandex-Images-${DATE}.jpg | |
| if ! [ -f ${DIR}/Yandex-Images-${DATE}.jpg ]; then | |
| wget -P ${DIR}/ ${URL} |