Получить список ip клиентов в редисе с группировкой
redis-cli client list | sed s/addr=//g | sed s/:.*//g | awk '{a[$2]++} END {for (i in a) print i"\t"a[i]}'127.0.0.1 2
127.0.0.2 1
127.0.0.3 1
Получить список ip клиентов в редисе с группировкой
redis-cli client list | sed s/addr=//g | sed s/:.*//g | awk '{a[$2]++} END {for (i in a) print i"\t"a[i]}'127.0.0.1 2
127.0.0.2 1
127.0.0.3 1
| <?php | |
| class TxtFileIterator implements \Iterator | |
| { | |
| protected $fileHandler; | |
| protected $current; | |
| protected $key; | |
| function __construct(string $filePath) |
| Ошибка: | |
| .\venv\Scripts\activate : Невозможно загрузить файл C:\path\venv\Scripts\activate.ps1, так как выполнение сценариев отключено в этой системе. | |
| Для получения дополнительных сведений см. about_Execution_Policies по адресу http://go.microsoft.com/fwlink/?LinkID=135170. | |
| строка:1 знак:1 | |
| .\venv\Scripts\activate | |
| ~~~~~~~~~~~~~~~~~~~~~~~ | |
| CategoryInfo : Ошибка безопасности: (:) [], PSSecurityException | |
| FullyQualifiedErrorId : UnauthorizedAccess | |
| Решение проблемы: |
| <?php | |
| $output = $modx->resource->_output; | |
| $output= preg_replace('|\s+|', ' ', $output); | |
| $modx->resource->_output = $output; |
| function array_clean($array) { | |
| if(!is_array($array)) return; | |
| foreach($array as $key => $value) { | |
| if(!is_array($value)){ | |
| $array[$key] = trim($value); | |
| if(strlen($value)==0) | |
| unset($array[$key]); | |
| } | |
| else | |
| $array[$key] = array_clean($value); |