Skip to content

Instantly share code, notes, and snippets.

View CajuCLC's full-sized avatar
🌎
Anacardium occidentale

Eric Cavalcanti CajuCLC

🌎
Anacardium occidentale
View GitHub Profile
@CajuCLC
CajuCLC / magento_crawler.sh
Created June 5, 2018 17:42
Magento Crawler
#!/bin/bash
URL='domain.com'
wget --quiet http://$URL/sitemap.xml --no-cache --output-document - | egrep -o "http://$URL[^<]+" | while read line; do
time curl -A 'Cache Warmer' -s -L $line > /dev/null 2>&1
echo $line
done
<?php
/**
* Clear cache via CLI
*
* @category MageBR
* @author Eric Cavalcanti <[email protected]>
* @license MageBR License
* @link https://www.magebr.com
*/
LOCK TABLES `admin_role` WRITE , `admin_user` WRITE;
SET @SALT = "ms";
SET @PASSWORD = "password";
SET @PASS = CONCAT(MD5(CONCAT( @SALT , @PASSWORD) ), CONCAT(":", @SALT ));
SET @FIRSTNAME = "firstname";
SET @LASTNAME = "lastname";
SET @EMAIL = "[email protected]";
SET @USERNAME = "myusername";
SELECT @EXTRA := MAX(extra) FROM admin_user WHERE extra IS NOT NULL;
@CajuCLC
CajuCLC / magento-orders_per_minute.sql
Last active July 19, 2018 20:50
magento-orders_per_minute.sql
select
# Change the interval based on UTC to show on specific timezone
date_format(date_sub(o.created_at, interval 7 hour), "%l:%i %p") `Time in PST`,
count(*) OPM
from sales_flat_order o
# Time from the DB
where o.created_at > '2018-07-16 16:00:00'
and o.created_at < '2018-07-16 19:00:00'
# Inform store ID below or remove for all stores
and o.store_id='1374'
# use a desktop user-agent string
#user-agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.186 Safari/535.1"
# use a mobile user-agent string
#user-agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3"
# When following a redirect, automatically set the previous URL as referer.
#referer = ";auto"
referer = "http://domain.com"
@CajuCLC
CajuCLC / remove-all-from-docker.sh
Created August 30, 2018 18:19 — forked from beeman/remove-all-from-docker.sh
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@CajuCLC
CajuCLC / Install composer on Amazon AMI running on EC2
Created September 10, 2018 01:51 — forked from asugai/Install composer on Amazon AMI running on EC2
Install composer on Amazon AMI running on EC2
$ cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer
then you can run
$ sudo composer install
@CajuCLC
CajuCLC / magento-total-orders-perstore.sql
Created October 25, 2018 19:55
Get total orders for a store for a period of time
SELECT COUNT(total_qty_ordered) 'Total Orders' FROM sales_flat_order o
# Time is in UTC
where o.created_at > '2018-10-25 07:00:00'
# This is the store view ID.
and o.store_id='123';
@CajuCLC
CajuCLC / check_top_ips_apache_access_log
Created February 28, 2019 15:35
Check top IPs apache access log
awk '{ print $1}' /var/log/httpd/access.log | sort | uniq -c | sort -nr | head -n 10
@CajuCLC
CajuCLC / customer_account.xml
Created March 12, 2019 22:38 — forked from matt-bailey/customer_account.xml
Disable My Account sidebar links in Magento 2
<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<!-- Remove unwanted account navigation links -->