Easy!
- Download latest tarball from https://sourceforge.net/projects/zint/files/latest/download
- Unpack it anywere
- Run:
sudo apt install libpng-dev cmake
cd build
cmake ..
make
<? | |
/** | |
* Простой класс для получения данных о пространстве на диске, разделе, в директории | |
* Может работать некорректно на shared-хостингах и при попытке получить данные | |
* о корневом разделе. | |
*/ | |
class DiskSpace | |
{ | |
/** |
Easy!
sudo apt install libpng-dev cmake
cd build
cmake ..
make
/** | |
* Определяет запущен ли скрипт через php-cli | |
* Checks if script running under php-cli | |
* | |
* @return bool | |
*/ | |
function is_cli(): bool | |
{ | |
return PHP_SAPI === 'cli' | |
|| (!isset($_SERVER['DOCUMENT_ROOT']) && !isset($_SERVER['REQUEST_URI'])); |
<?php | |
/** | |
* Класс для работы с Asterisk по протоколу AMI через сокет. | |
* Реализовано: подключение, авторизация, отправка команд, отправка СМС, отключение. | |
* Успешно работало на проде в связке с Yeastar TG400. | |
* | |
* Class to work with Asterisk gateway throuth AMI protocol via socket. | |
* Features: connection, authorization, send commands, send SMS, disconnect. | |
* Successfully used in production with Yeastar TG400. |
<?php | |
/** | |
* Проверяет корректность синтаксиса php-файла | |
* | |
* @param string $filepath Путь к файлу | |
* @param int $exitcode Код выхода процесса php | |
* @return array Массив строк результата | |
*/ | |
function php_syntax_file(string $filepath, int &$exitcode = 0): array { |
#!/bin/bash | |
# Based on: | |
# https://github.com/Powerlevel9k/powerlevel9k/wiki/Install-Instructions | |
# https://github.com/ohmyzsh/ohmyzsh | |
# https://powerline.readthedocs.io/en/latest/installation/linux.html#fonts-installation | |
# https://gist.github.com/dogrocker/1efb8fd9427779c827058f873b94df95 | |
# https://linuxhint.com/install_zsh_shell_ubuntu_1804/ | |
echo "*********************************************" | |
echo " zsh fancifier" |
<?php | |
/** | |
* Simple php equivalent of Oracle's decode() | |
* | |
* It can be used as simple oneline-alternative to switch or if operators in many | |
* cases without difficult logic. For example, get string mnemocode of some value: | |
* | |
* echo 'State: '.decode($state, 0, 'disabled', 1, 'enabled', 'unknown'); | |
* |
<?php | |
/** | |
* Simple php equivalent of Oracle's coalesce() | |
* | |
* It can be used as simple oneline-alternative to switch or if operators in many | |
* cases without difficult logic. For example, get first non-empty value from bunch of vars: | |
* | |
* echo coalesce($var1, $var2, $var3, ...); | |
* |
# Original: https://gist.github.com/akostadinov/33bb2606afe1b334169dfbf202991d36 | |
# The difference is that this func outputs stacktrace in reverse order (from top level to lower ones) | |
function print_stacktrace () { | |
STACK="" | |
local i | |
local stack_size=${#FUNCNAME[@]} | |
echo "Stacktrace:" | |
# skip this function and "MAIN non_file_source:0" | |
for (( i=$stack_size-1; i>=1; i-- )); do | |
local func="${FUNCNAME[$i]}" |