Skip to content

Instantly share code, notes, and snippets.

View helirexi's full-sized avatar

Andrew Sparks helirexi

  • Magento dev
  • Ukraine
View GitHub Profile
@helirexi
helirexi / docker-compose-backup.sh
Created July 30, 2020 11:49 — forked from pirate/docker-compose-backup.sh
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
# Fully backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
project_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
cd "$project_dir"
project_name=$(basename "$project_dir")
backup_time=$(date +"%Y-%m-%d_%H-%M")
backup_dir="$project_dir/data/backups/$backup_time"
@helirexi
helirexi / CODE_AND_DB_DUMP
Created May 14, 2020 20:51 — forked from tshabatyn/CODE_AND_DB_DUMP.MD
Making Code and DB dump
# Code dump
```bash
tar cf - ./ --exclude=pub/media/catalog/* --exclude=pub/media/* --exclude=pub/media/backup/* --exclude=pub/media/import/* --exclude=pub/media/tmp/* --exclude=pub/static/* --exclude=var/* --exclude=private --exclude=tests | gzip > /tmp/`date +%s`.code.tar.gz
```
After execution you will be able to find dump in the directory `/tmp`
```bash
ls -laht /tmp/*.code.tar.gz
```
Your dump will be shown at the top of the listed dumps.
@helirexi
helirexi / msys_hetzner-etc_network_interfaces
Created April 17, 2019 20:55 — forked from jpawlowski/msys_hetzner-etc_network_interfaces
Debian network configuration for Proxmox VE server running on a Hetzner host
# /etc/network/interfaces
#
auto lo
iface lo inet loopback
# device: eth0
iface eth0 inet manual
# IPv4 bridge
# (connect ONLY your firewall/router KVM instance here, this is the WAN device!)
@helirexi
helirexi / msys_hetzner-etc_network_interfaces
Created April 15, 2019 12:23 — forked from EugenMayer/msys_hetzner-etc_network_interfaces
Debian network configuration for Proxmox VE server running on a Hetzner host
# /etc/network/interfaces
#
auto lo
iface lo inet loopback
# device: eth0
iface eth0 inet manual
# IPv4 bridge
# (connect ONLY your firewall/router KVM instance here, this is the WAN device!)
@helirexi
helirexi / openvz_setup.sh
Created April 10, 2019 15:12 — forked from levnovikov/openvz_setup.sh
Setup OpenVZ node (Hetzner)
#!/bin/sh
installimage -r no -i images/CentOS-68-64-minimal.tar.gz -n node01.domain.tld -p /boot:ext3:256M,/:ext4:10G,/vm:ext4:all -K http://10.0.0.1/key.pub -a
yum -y remove selinux\*
ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
service ntpd start
ntpq -p
chkconfig --level 345 ntpd on
@helirexi
helirexi / blocklist.txt
Created July 3, 2018 11:25 — forked from hn-support/blocklist.txt
A curated list of user agents that use lot's of resources but don't cause more conversion or add any value to most of the webshops
360Spider
80legs\.com
ADmantX
Abonti
AcoonBot
Acunetix
AddThis\.com
AhrefsBot
AngloINFO
Antelope
@helirexi
helirexi / Magento.md
Created April 22, 2018 07:12 — forked from OdinsHat/Magento.md
Magento Cook book

Magento Snippets

Changing Order Status

// shipping_cdl setup in the admin area under shipping methods
$orderModel = Mage::getModel('sales/order');
$orderModel->reset()->load($orderId);
$orderModel->addStatusHistoryComment('Sent to CDL', 'shipping_cdl');
$orderModel->setStatus('shipping_cdl')->save();
@helirexi
helirexi / git.migrate
Created March 4, 2017 13:06 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.

Magento Snippets

Set all categories to is_anchor 1

Find attribute_id

SELECT * FROM eav_attribute where attribute_code = 'is_anchor'

Update all of them with anchor_id from above (usually is ID 51)

UPDATE `catalog_category_entity_int` set value = 1 where attribute_id = 51
@helirexi
helirexi / cleanImages.php
Created April 6, 2016 07:44 — forked from peterjaap/cleanImages.php
Script to clean up the images tables in a Magento installation. Removes references to non-existing images, removes duplicate images, sets correct default image and deletes orphaned images from the filesystem.
<?php
/*
* This script deletes duplicate images and imagerows from the database of which the images are not present in the filesystem.
* It also removes images that are exact copies of another image for the same product.
* And lastly, it looks for images that are on the filesystem but not in the database (orphaned images).
*
* This script can most likely be optimized but since it'll probably only be run a few times, I can't be bothered.
*
* Place scripts in a folder named 'scripts' (or similar) in the Magento root.