Skip to content

Instantly share code, notes, and snippets.

@devzorg
devzorg / my.cnf
Created March 27, 2023 20:18 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@devzorg
devzorg / onvif multi platform
Created March 29, 2018 10:57
ONVIF server crossplatform compilation
Профили протокола https://www.onvif.org/profiles/
Спецификация и WSDL https://www.onvif.org/profiles/specifications/
SERVERS::
c#
https://github.com/sarthak-k/Onvif.Open
https://github.com/ticapix/onvifserver
Java
https://github.com/hhbgk/WebService
@devzorg
devzorg / magento_url_rewrite.patch
Created December 15, 2017 09:10 — forked from edannenberg/magento_url_rewrite.patch
Fixes the catalog url rewrite indexer in Magento 1.7.x-1.9.x See https://github.com/magento/bugathon_march_2013/issues/265 for details.Update: DexterDee in the ticket above noted that the previous patch had some side effects. This updated patch still feels like duct tape but at least it seems to be free of the mentioned side effects. It also fix…
diff -rupN mage_org/app/code/core/Mage/Catalog/Model/Url.php src_shop/app/code/core/Mage/Catalog/Model/Url.php
--- mage_org/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:48:25.679009391 +0100
+++ src_shop/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:49:24.188005601 +0100
@@ -643,13 +643,24 @@ class Mage_Catalog_Model_Url
$this->_rewrite = $rewrite;
return $requestPath;
}
+
+ // avoid unnecessary creation of new url_keys for duplicate url keys
+ $noSuffixPath = substr($requestPath, 0, -(strlen($suffix)));
@devzorg
devzorg / import_single_table
Created July 20, 2020 08:36
Import one table from big sql file
sed -n -e '/CREATE TABLE.*`TABLE_TO_FIND`/,/CREATE TABLE/p' bigdump.sql > single-table-dump.sql
-- full path by child id
WITH RECURSIVE category_path (id, title, parent_id) AS
(
SELECT id, title, parent_id
FROM magedev_seotree
WHERE id = 17 AND store_id=1
UNION ALL
SELECT c.id, c.title, c.parent_id
FROM category_path AS cp JOIN magedev_seotree AS c
ON cp.parent_id = c.id
1. https://alanstorm.com/magento-2-setup-migration-scripts/
2. https://devdocs.magento.com/guides/v2.3/extension-dev-guide/declarative-schema/data-patches.html
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_cluster/settings -d '{ "transient": { "cluster.routing.allocation.disk.threshold_enabled": false } }'
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
<?php/*test*/echo 'test';
expected:
test
result:
<?php/*test*/echo 'test';
@devzorg
devzorg / add-checkout-form-key.sh
Created May 25, 2018 11:26 — forked from schmengler/add-checkout-form-key.sh
Magento SUPEE-9767 Checkout Form Key Theme Patch
find -L app/design/frontend -regex '.*\(shipping\|billing\|shipping_method\|payment\).phtml' -exec grep -L formkey {} \; \
| xargs sed -i 's/<\/form>/<?php echo $this->getBlockHtml("formkey") ?><\/form>/g'
find -L skin/frontend -name 'opcheckout.js' -exec grep -L form_key {} \; \
| xargs sed -i 's/if (elements\[i\].name=='\''payment\[method\]'\'') {/if (elements[i].name=='\''payment[method]'\'' || elements[i].name == '\''form_key'\'') {/g'
#!/bin/bash
USER=user
PASS=pass
DBNAME=dbname
BKP_PATH=/backups
PATH=/var/www/site/data/www
mysqldump -u${USER} -p --lock-tables=false --single-transaction --quick --hex-blob --routines --triggers ${DBNAME} | gzip > ${DBNAME}_(DATE).sql.gz &
tar -C ${PATH} -zcpf ${BKP_PATH}/${DBNAME}.tgz ./