Skip to content

Instantly share code, notes, and snippets.

View peterjaap's full-sized avatar

Peter Jaap Blaakmeer peterjaap

  • elgentos ecommerce solutions / Blaakmeer Webdevelopment
  • Groningen, the Netherlands
View GitHub Profile
@peterjaap
peterjaap / clean-core-config-data-duplicate-values.sql
Last active June 7, 2022 08:49
Delete core_config_data values where the fallback value in scope 0 is the same
DELETE FROM core_config_data WHERE config_id IN (SELECT config_id
FROM (SELECT DUPS.*
FROM core_config_data ORIG
LEFT JOIN core_config_data DUPS
ON ORIG.path = DUPS.path AND (ORIG.value = DUPS.value OR (ORIG.value IS NULL AND DUPS.value IS NULL))
AND DUPS.scope != "default" AND DUPS.scope_id != 0
WHERE ORIG.scope = "default"
AND ORIG.scope_id = 0
AND DUPS.path IS NOT NULL) as tmp)
@peterjaap
peterjaap / .dbdiff
Created November 30, 2020 12:42
dbdiff config file for M2 - see https://github.com/DBDiff/DBDiff
server1:
user: peterjaap
password:
port: 3306
host: db
server2:
user: peterjaap
password:
port: 3306
host: db
@peterjaap
peterjaap / Magento generated events
Created October 14, 2013 09:44
Magento generated events; a number of models use automatically generated events through prefixes. This is a (non-exhaustive) list of a number of those events, combined with _save_before, _save_after, _save_commit_after, _delete_before, _delete_after, _delete_commit_after, _load_before & _load_after.
tag_save_after
admin_roles_save_after
admin_user_save_after
review_save_after
catalogsearch_query_save_after
sales_order_save_after
sales_quote_address_save_after
sales_quote_payment_save_after
sales_quote_item_save_after
sales_quote_save_after
@peterjaap
peterjaap / Crawler.php
Last active February 3, 2022 21:23
Sitemap Crawler coded during live session at Virtual Magento Meetup 30-04-2020
<?php declare(strict_types=1);
namespace VirtualMeetup\SitemapCrawler\Console\Command;
use Graze\ParallelProcess\Event\RunEvent;
use Graze\ParallelProcess\PriorityPool;
use Graze\ParallelProcess\RunInterface;
use Magento\Framework\Filesystem\Driver\File;
use Magento\Framework\HTTP\Client\Curl;
@peterjaap
peterjaap / .gitlab-ci.yaml
Last active January 12, 2022 16:37
Generic Gitlab CI file to build and push a Docker container to the private registry using kaniko (no Docker in Docker privileged mode needed)
image: docker:latest
stages:
- build
build:
stage: build
only:
- master
image:
@peterjaap
peterjaap / varnishlog-examples.sh
Created June 24, 2020 09:40 — forked from cupracer/varnishlog-examples.sh
varnishlog examples (version 4.x)
# filter by request host header
varnishlog -q 'ReqHeader ~ "Host: example.com"'
# filter by request url
varnishlog -q 'ReqURL ~ "^/some/path/"'
# filter by client ip (behind reverse proxy)
varnishlog -q 'ReqHeader ~ "X-Real-IP: .*123.123.123.123"'
# filter by request host header and show request url and referrer header
@peterjaap
peterjaap / move-duplicate-theme-files.sh
Created September 22, 2021 11:55
Magento 2 - move duplicate themes files to new theme
#!/bin/bash
# Move duplicate themes files to new theme
OLDVENDOR="Vendor"
NEWVENDOR="Newvendor"
NEWTHEMENAME="Themename"
find app/design/frontend ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD | cut -d' ' -f3 | while read a;
do
@peterjaap
peterjaap / packit4me.php
Last active June 4, 2021 03:08
Packit4me 3d viz
<?php
$url = "http://www.packit4me.com/api/call/raw";
$previewUrl = "http://www.packit4me.com/api/call/preview";
$bin = [
'id' => 0,
'maxweight' => 50,
'dimensions' => '5x5x5'
];
@peterjaap
peterjaap / run-profile.php
Created May 22, 2021 18:42
Run Magento export profile CLI
<?php
set_time_limit(0);
//THIS SCRIPT JUST INITIALS THE PROFILE TO BE RUN VIA MAGENTO ADMIN "RUN PROFILE IN POPUP". Its the same thing as click just via this file that you can run via cron
$profileId = $argv[1]; // SYSTEM - IMPORT/EXPORT - DATAFLOW PROFILES PROFILES <-- you need to go into your magento admin and grab the exact profile ID
require_once 'app/Mage.php';
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
find app/design/frontend/Limburgia/default -maxdepth 1 -type d | grep -vE "web|etc|i18n|media"
app/design/frontend/Limburgia/default
app/design/frontend/Limburgia/default/Magento_Customer
app/design/frontend/Limburgia/default/Magento_ConfigurableProduct
app/design/frontend/Limburgia/default/Magento_LayeredNavigation
app/design/frontend/Limburgia/default/Magento_ReCaptchaCustomer
app/design/frontend/Limburgia/default/Magento_Wishlist
app/design/frontend/Limburgia/default/Magento_Checkout
app/design/frontend/Limburgia/default/Magento_CatalogSearch
app/design/frontend/Limburgia/default/Magento_Tax