Skip to content

Instantly share code, notes, and snippets.

@artttj
artttj / MassDeleteElasticsuiteGhostIndices.php
Last active May 29, 2024 20:44
Script to Mass Delete Ghost Indices (Magento 2; smile/elasticsuite)
<?php
use Magento\Framework\App\Bootstrap;
use Magento\Framework\App\State;
use Magento\Framework\ObjectManagerInterface;
require __DIR__ . '/app/bootstrap.php';
class Test
{
@artttj
artttj / openapi3.json
Created September 8, 2023 15:46
Shopware 6 OpenApi Spec
This file has been truncated, but you can view the full file.
{"openapi":"3.0.0","info":{"title":"Shopware Admin API","description":"This endpoint reference contains an overview of all endpoints comprising the Shopware Admin API.\n\nFor a better overview, all CRUD-endpoints are hidden by default. If you want to show also CRUD-endpoints\nadd the query parameter `type=jsonapi`.","version":"6.5.3.3"},"servers":[{"url":"https:\/\/shopware-6-demo.localhost\/api"}],"paths":{"\/acl-role":{"get":{"tags":["Acl Role"],"summary":"List with basic information of Acl Role resources","description":"Available since: 6.0.0.0","operationId":"getAclRoleList","parameters":[{"name":"limit","in":"query","description":"Max amount of resources to be returned in a page","schema":{"type":"integer"}},{"name":"page","in":"query","description":"The page to be returned","schema":{"type":"integer"}},{"name":"query","in":"query","description":"Encoded SwagQL in JSON","schema":{"type":"string"}}],"responses":{"200":{"description":"List of Acl Role resources.","content":{"application\/vnd.api+json":{"sc
@artttj
artttj / magento2_update_stock_qty_csv.php
Last active August 26, 2021 13:27
Magento 2 Update Stock Qty from CSV
<?php
/**
* Script to import/update stocks/inventory/qty in bulk via CSV
*
* @author Artyom Yagovdik <artyom.yagovdik@gmail.com>
* @website https://artttj.github.io/
*/
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
@artttj
artttj / check_d_space.sh
Last active October 31, 2017 07:41
check inodes disk space and mail
#!/bin/bash
MAILTO="y@b.biz,e@b.biz,a@b.biz,t@b.com"
USAGE=90 # inode usage - value in percent
dui=$(df -hi | sed -n '4p' |awk '{print $5}' | grep -v U|cut -d% -f1)
if [ $dui -gt $USAGE ]
then
echo "Inode usage on 52.52.52.135 is exceeded - $dui%" |mailx -s "Inode usage on $(hostname)" $MAILTO
fi
@artttj
artttj / fix.sh
Last active April 9, 2018 16:56
ENOSPC node ERROR avoiding / Laravel Yarn watch / Webpack Mix
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@artttj
artttj / create-updated-data-scripts-sp.php
Created December 5, 2016 05:37
Create Theme Data Upgrade SP
<?php
class Versions {
public function __construct() {
}
public static function create() {
return new self();
}
@artttj
artttj / modules.txt
Created November 16, 2016 06:24
My PHP modules
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
ereg
exif
@artttj
artttj / magento_sql_duplciate_store.sql
Created November 8, 2016 09:08
Duplicate entry '1' for key 'PRIMARY' in data migration in Magento
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `core_store`;
CREATE TABLE `core_store` (
`store_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Store Id',
`code` varchar(32) DEFAULT NULL COMMENT 'Code',
`website_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Website Id',
`group_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Group Id',
`name` varchar(255) NOT NULL COMMENT 'Store Name',
`sort_order` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Store Sort Order',
@artttj
artttj / Python_Urllib_Basic_Auth_Query.py
Created September 22, 2016 17:34
Python 3.4 Urllib Basic Auth: the script sends JSON data via POST request using HTTP Basic authentication and urllib.
import urllib.request
import urllib.response
userName = "user"
passWord = "password"
top_level_url = "http://127.0.0.1/api/update"
# create an authorization handler
p = urllib.request.HTTPPasswordMgrWithDefaultRealm()
p.add_password(None, top_level_url, userName, passWord);
@artttj
artttj / magento.conf
Last active October 4, 2016 05:46
Magento NGINX Server Config
server {
listen 80 default_server;
listen [::]:80 default_server;
root /home/me/domains/example;
index index.html index.php;
server_name example.dev;
##
# redirect to www