Skip to content

Instantly share code, notes, and snippets.

View yvoronoy's full-sized avatar

Yarik Voronoy yvoronoy

View GitHub Profile
#
# (cd $(espanso path | grep Config | awk '{print $2}'); curl -o user/jira.yml https://gist.githubusercontent.com/yvoronoy/560419750e254747481d66edc8681d02/raw/4f466e9882db7b176a5a156c1c83f4ff73d64944/gistfile1.txt)
#
name: Jira
parent: default
matches:
- trigger: ":placeholder"
replace: "!https://via.placeholder.com/150!"
- trigger: ":epic"
replace: |
@yvoronoy
yvoronoy / install.sh
Last active September 21, 2021 19:43
SWAT Agent Installer
#!/usr/bin/env bash
set -Eeuo pipefail
agentPath=
appName=
license=
agentConfigPath=
appRoot=
phpPath=$(command -v php)
@yvoronoy
yvoronoy / query_cache_stats.sh
Last active January 27, 2021 19:39
Query Cache Hit Ratio
#!/usr/bin/env bash
# Current size compared with maximum available size:
# ((query_cache_size-Qcache_free_memory)/query_cache_size)*100
# Hit Ratio Among all queries
# Qcache_hits / (QCache_hits + Com_select)
export DB_NAME=$(grep [\']db[\'] -A 20 app/etc/env.php | grep dbname | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/['][,]//");
export MYSQL_HOST=$(grep [\']db[\'] -A 20 app/etc/env.php | grep host | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/['][,]//");
export DB_USER=$(grep [\']db[\'] -A 20 app/etc/env.php | grep username | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/['][,]//");
@yvoronoy
yvoronoy / magento2-elasticsearch
Last active December 11, 2019 22:53
Magento2 ElasticSearch Helper
Run this command first to get proper connection
SUP_ES_HOST=localhost:9200
SUP_ES_INDEX_NAME=magento2
vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php
$curlCmd = sprintf('curl -X%s -H \'%s\' %s%s -d \'%s\'',
$method,
'Content-type: application/json',
$this->host,
@yvoronoy
yvoronoy / README-Template.md
Created November 17, 2017 17:43 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@yvoronoy
yvoronoy / helpers
Last active August 24, 2022 16:55
How many unprocessed entities by indexer
export DB_NAME=$(grep [\']db[\'] -A 20 app/etc/env.php | grep dbname | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/['][,]//");
export MYSQL_HOST=$(grep [\']db[\'] -A 20 app/etc/env.php | grep host | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/['][,]//");
export DB_USER=$(grep [\']db[\'] -A 20 app/etc/env.php | grep username | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/['][,]//");
export MYSQL_PWD=$(grep [\']db[\'] -A 20 app/etc/env.php | grep password | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/[']$//" | sed "s/['][,]//");
mysql -h $MYSQL_HOST -u $DB_USER --password=$MYSQL_PWD $DB_NAME -U
pager less -S;
#URLs
mysql -h $MYSQL_HOST -u $DB_USER --password=$MYSQL_PWD $DB_NAME -e "SELECT * FROM core_config_data WHERE path = 'web/unsecure/base_url' OR path = 'web/secure/base_url'"
@yvoronoy
yvoronoy / MAGENTO_ENABLE_MYSQL_DEBUG.patch
Created October 10, 2017 20:44
Magento2 - MySQL Debug Log Enabler PATCH
diff --git app/etc/di.xml app/etc/di.xml
index 69403de..b43d771 100755
--- app/etc/di.xml
+++ app/etc/di.xml
@@ -93,7 +93,13 @@
<preference for="Magento\Framework\Api\MetadataObjectInterface" type="Magento\Framework\Api\AttributeMetadata"/>
<preference for="Magento\Framework\Api\SearchCriteriaInterface" type="Magento\Framework\Api\SearchCriteria"/>
<preference for="Magento\Framework\App\Rss\UrlBuilderInterface" type="Magento\Framework\App\Rss\UrlBuilder"/>
- <preference for="Magento\Framework\DB\LoggerInterface" type="Magento\Framework\DB\Logger\Quiet"/>
+ <preference for="Magento\Framework\DB\LoggerInterface" type="Magento\Framework\DB\Logger\File"/>
@yvoronoy
yvoronoy / Magento2-rest-curl-examples
Created May 11, 2017 16:13
Magento2 API Examples
#!/bin/bash
# CREATE CATEGORY REST API
TOKEN=
BASE_URL=$1
echo $BASE_URL
TOKEN=$(curl -X POST "${BASE_URL}index.php/rest/V1/integration/admin/token" \
-H "Content-Type:application/json" \
@yvoronoy
yvoronoy / m2dump
Last active September 10, 2019 14:33
Magento 2 Code and DB dumps
#!/usr/bin/env bash
function runCommand
{
echo "${CMD}"
eval ${CMD};
}
function getDb
{
echo $(grep [\']db[\'] -A 20 app/etc/env.php | grep $1 | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/['][,]//");
return 0;
@yvoronoy
yvoronoy / CODE_AND_DB_DUMP.MD
Last active April 26, 2023 08:35 — forked from tshabatyn/CODE_AND_DB_DUMP.MD
How to Generate Magento2 Code and DB dumps

Code dump

You can use tiny script m2dump it is doing the same thing as described below.

Estimate size of directories and exclude no needed.

du -sh ./* | sort -h