Skip to content

Instantly share code, notes, and snippets.

View daniDLL's full-sized avatar
😎

Daniel Delgado daniDLL

😎
View GitHub Profile
@daniDLL
daniDLL / restore-deleted-stash.md
Created October 30, 2023 08:46
Restore deleted stash
git fsck --unreachable | grep commit | cut -d" " -f3 | xargs git log --merges --no-walk --grep=<commit message>
@daniDLL
daniDLL / mysql-docker.sh
Created November 9, 2022 13:15 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@daniDLL
daniDLL / docker-command-magento-composer-install
Last active December 15, 2021 09:46
Docker command for a clean installation of composer packages for a Magento project
docker run --user root --rm --volume=<local-path>:/var/www/html modestcoders/php:7.4-fpm /bin/bash -c "composer self-update --2 && composer install"
@daniDLL
daniDLL / _Magento2_DeleteTestData.md
Created September 17, 2021 07:48 — forked from leek/_Magento2_DeleteTestData.md
Magento 2 - Delete All Test Data

These set of scripts are for Magento 2. For Magento 1, see this Gist.

@daniDLL
daniDLL / get-schema-table-size.sql
Created December 18, 2020 11:17
get-schema-table-size
SELECT TABLE_NAME AS `Table`, ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)` FROM information_schema.TABLES WHERE TABLE_SCHEMA = "<database-schema>" ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC;
@daniDLL
daniDLL / magento-knockout-uicomponent-template-hints
Created May 11, 2020 11:40
Add Magento Knockout uiComponent "template-hints" for debugger purpose
Path: vendor/magento/module-ui/view/base/web/templates/collection.html
<each args="data: elems, as: 'element'">
<pre data-bind="text: element.getTemplate()"></pre>
<pre data-bind="text: ko.toJSON(element.index, null, 2)"></pre>
<render if="hasTemplate()"/>
</each>
@daniDLL
daniDLL / anonymize_local_customer_emails
Last active June 1, 2022 12:18
anonymize-local-customer-emails
UPDATE customer_entity SET email = CONCAT(SUBSTRING(MD5(UUID()), 1, 15) , '@example.com') where entity_id > 0;
UPDATE sales_order SET customer_email = CONCAT(SUBSTRING(MD5(UUID()), 1, 15) , '@example.com') where entity_id > 0;
kill -9 `ps -ef | grep 'pattern' | awk '{print $2}'`
@daniDLL
daniDLL / how-to-add-more-dav-methods-nginx
Created December 10, 2019 08:21
How to add more DAV methods to an nginx installation
### Download module
https://github.com/arut/nginx-dav-ext-module
### Configure Install
./configure --prefix=/usr/share/nginx \
--sbin-path=/usr/sbin/nginx \
--modules-path=/usr/lib/nginx/modules \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
@daniDLL
daniDLL / show-queries-real-time
Last active March 2, 2020 15:47
Show executed queries in real time
## Show real-time
watch -n1 'mysql -u root -ppassword --execute="SHOW FULL PROCESSLIST"'
## Show real-time and pipe all info to file
watch -t -n1 '(mysql -h dbhost -u dbuser dbname -ppassword --execute="SHOW FULL PROCESSLIST") | tee -a mysql-process-list.log'
## Show slow queries real-time and pipe all info to file
watch -t -n1 '(mysql -h dbhost -u dbuser dbname -ppassword --execute="SELECT * FROM information_schema.processlist WHERE TIME > 5 ORDER BY TIME DESC") | tee -a /tmp/mysql-process-list.log'