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 / 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'
@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
#!/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 ./
@devzorg
devzorg / patch-7136
Created January 11, 2018 14:03 — forked from molotovbliss/patch-7136
Magento v1 SUPEE-7136 Cookies : 'frontend_cid' is never renewed, compared to 'frontend' one. So session often expires.
Sauce: https://community.magento.com/t5/Technical-Issues/Cookies-frontend-cid-is-never-renewed-compared-to-frontend-one/td-p/41077
The core code seems to have forgotten to include the logic to renew the frontend_cid cookie.
I have contacted Magento support regarding this and they provided me a patch - SUPEE-7136, however I'm not seeing it published online anywhere...
The issue lies in this file:
app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
What the patch does is replace this: