Skip to content

Instantly share code, notes, and snippets.

View wirwolf's full-sized avatar

Andru Cherny wirwolf

View GitHub Profile
<?php
function xmlToArray(string $xml)
{
$doc = new DOMDocument();
$doc->loadXML($xml);
$root = $doc->documentElement;
$output = domNodeToArray($root);
$output['@root'] = $root->tagName;
return $output;
@wirwolf
wirwolf / ecosystem.json
Created June 14, 2018 20:13
pm2 ecosystem.json config example
{
"apps": [
{
/* General */
"name": "my-api", /* (string) application name (default to script filename without extension) */
"script": "index.js", /* (string) script path relative to pm2 start */
"cwd": "/var/www/", /* (string) the directory from which your app will be launched */
"args": "-a 13 -b 12", /* (string) string containing all arguments passed via CLI to script */
"interpreter": "/usr/bin/python", /* (string) interpreter absolute path (default to node) */
"interpreter_args": "--harmony", /* (string) option to pass to the interpreter */
cd /tmp
wget http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb
dpkg -i zabbix-release_3.4-1+xenial_all.deb
apt-get update
apt install zabbix-agent zabbix-sender zabbix-get
#rabbitmq
echo "deb https://dl.bintray.com/rabbitmq/debian xenial main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -
sudo apt-get update
docker kill $(docker ps -q)
docker rm $(docker ps -a -q) -f
docker rmi $(docker images -q) -f
docker system prune
docker-compose up -d
docker-compose run --rm app bin/wait # ждет пока поднимется все
docker-compose run --rm app bin/console doctr:mig:mig -n
docker-compose run --rm app bin/phpunit --testsuite integration
docker kill $(docker ps -q)
docker rm $(docker ps -a -q) -f
docker rmi $(docker images -q) -f
docker system prune --volumes
[user]
name = {{имя}} {{фамилия}}
email = {{емейл}}
[core]
symlinks = false
autocrlf = true
repositoryformatversion = 0
filemode = false
[color]
diff = auto
define('ROOT', dirname(dirname(__DIR__)) . '/');
require_once ROOT . 'vendor/autoload.php';
use Codeception\Configuration;
$kernel = AspectMock\Kernel::getInstance();
$kernel->init([
'debug' => true,
'appDir' => ROOT.'app',
@wirwolf
wirwolf / gist:300732fbadfc7815ebef
Last active March 16, 2016 13:21
nginx config(angular app + yii2)
#frontend
server {
listen 80;
server_name admin.host.com;
server_tokens off;
client_max_body_size 8M;
charset utf-8;
access_log /home/www-data/admin.host.com/logs/frontend-access.log;
<?php
ini_set("error_reporting", E_ALL & ~E_DEPRECATED);
define('projects_dir',"www/");
define('apache_dir',"/etc/apache2/");
define('apache_config_www_folder',"/home/\${APACHE_RUN_USER}/Web/www/");
define('host_delimiter',"#------------------APACHE 2 HOSTS UPDATER---DONT MODIFY THIS BLOCK-----------------");
$doneHosts = [];
@wirwolf
wirwolf / gist:75ada889face3b6fd931
Last active February 25, 2016 14:39
mysql fix encoding
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', DATA_TYPE, ' CHARACTER SET UTF8 COLLATE utf8_bin;')
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = 'jira'
AND DATA_TYPE != 'varchar'
AND
(
CHARACTER_SET_NAME != 'utf8'
OR
COLLATION_NAME != 'utf8_bin'