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 / README.mkd
Created May 29, 2019 23:22 — forked from vrillusions/README.mkd
Generate gpg key via batch file

Introduction

This is how to create a gpg key without any user interaction or password. This can be used in cases where the primary goal is to secure the data in transit but the gpg key can/must be stored locally without a password. An example of this is the hiera-gpg plugin which doesn't support passwords.

The below genkey-batch file will use the default which currently are RSA/RSA and 2048 bit length. See the reference link to set this to something else.

References

@CajuCLC
CajuCLC / kubectl-shortcuts.sh
Created April 11, 2019 07:00 — forked from tamas-molnar/kubectl-shortcuts.sh
aliases and shortcuts for kubectl
alias kc='kubectl'
alias kclf='kubectl logs --tail=200 -f'
alias kcgs='kubectl get service -o wide'
alias kcgd='kubectl get deployment -o wide'
alias kcgp='kubectl get pod -o wide'
alias kcgn='kubectl get node -o wide'
alias kcdp='kubectl describe pod'
alias kcds='kubectl describe service'
alias kcdd='kubectl describe deployment'
alias kcdf='kubectl delete -f'
@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 -->
@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 -->
@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 / 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 / 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 / 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
# 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 / 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'