Skip to content

Instantly share code, notes, and snippets.

@shebin512
shebin512 / magedeploy.sh
Created August 8, 2021 18:44 — forked from rafaelstz/magedeploy.sh
Magento 2 Deploy script
#!/usr/bin/env bash
LANGUAGES="en_US pt_BR"
# production or developer
ENVIRONMENT="production"
COMPOSER=$(which composer)
PHP=$(which php)
ROOT=$(pwd)
@shebin512
shebin512 / myip.sh
Created November 7, 2020 21:27
Get IP details of your system
function myip() {
curl http://icanhazip.com
ip addr | grep inet$IP | \
cut -d"/" -f 1 | \
grep -v 127\.0 | \
grep -v \:\:1 | \
awk '{$1=$1};1'
}
@shebin512
shebin512 / Bash-tips-for-everyday-at-the-command-line.sh
Last active November 7, 2020 19:06
Bash script tips and tricks
#!/usr/bin/env bash
# https://opensource.com/article/18/5/bash-tricks
# History related
ctrl + r (reverse search)
!! (rerun last command)
!* (reuse arguments from previous command)
!$ (use last argument of last command)
shopt -s histappend (allow multiple terminals to write to the history file)
history | awk 'BEGIN {FS="[ \t]+|\\|"} {print $3}' | sort | uniq -c | sort -nr | head (list the most used history commands)
@shebin512
shebin512 / curl.sh
Last active September 22, 2020 18:52 — forked from exAspArk/curl.sh
Test CORS with cURL
curl -I -X OPTIONS \
-H "Origin: http://EXAMPLE.COM" \
-H 'Access-Control-Request-Method: GET' \
http://EXAMPLE.COM/SOMETHING 2>&1 | grep -i 'Access-Control-Allow-Origin'
@shebin512
shebin512 / send-email.sh
Last active February 16, 2021 20:20
cUrl Send email using SMTP
source ./sendEmailCurl-v1.1.sh # OR ./sendEmailCurl-v1.0.sh
EMAILTO='user1@example.com,user2@test1.com' \
EMAILSUBJECT="Test EMAIL $(date +%F)" \
EMAILBODY="This is a test email from $(HOSTNAME)\n USER $(USER)" \
sendEmail "$@"
exit 0
@shebin512
shebin512 / magento2-gist.md
Last active May 19, 2018 08:56
Magento 2

Magento 2 Gists


Module creation via n98-magerun2.phar

emb-shebshe@emb-ban-297 /var/www/html/bfl-magento/htdocs $ n98-magerun2.phar dev:module:create --help
Usage:
 dev:module:create [-m|--minimal] [--add-blocks] [--add-helpers] [--add-models] [--add-setup] [--add-all] [-e|--enable] [--modman] [--add-readme] [--add-composer] [--author-name [AUTHOR-NAME]] [--author-email [AUTHOR-EMAIL]] [--description [DESCRIPTION]] [--] <vendorNamespace> <moduleName>

Arguments:
@shebin512
shebin512 / MySnippets.md
Last active November 3, 2017 12:26
My Snippets

My Snippets

 svn st |grep "^M"|awk '{print $2}'|while read line; do svn diff $line;done
 svn st |grep "^M"|awk '{print $2}'|while read line; do echo $line;done
 svn st |grep "^M"|awk '{print $2}'|while read line; do echo -n $line, ;done //without trailing new line and comma seperated
 svn st |grep "^M"|awk '{print $2}'|while read line; do echo -n $line" " ;done //without trailing new line and single space (" ") seperated
 svn ci `svn st |grep "^M"|awk '{print $2}'|while read line; do echo -n $line" ";done` //svn commit all the modified files

Find Script to find file names in dir from list of file

@shebin512
shebin512 / Magento_Patch_bash.md
Last active January 29, 2016 13:31
Bash Scripts used in Magento Patch works.

WELCOME :trollface:

CE Patch

grep -i -e"diff --git" PATCH_SUPEE-*|awk '{print $3}'|while read line;do meld /var/www/html/magento1911/$line /var/www/html/puma/$line  ;done

tar -zcvf  evoke_live.tgz htdocs/ --exclude=media --exclude=var --exclude="*.tgz" --exclude="*.gz" --exclude="*.tar" --exclude=blog --exclude=media_bck --exclude=.svn --exclude=blog_old --exclude=media_orig


grep -i -e"diff --git" PATCH_SUPEE-*|awk '{print $3}'|while read line;do meld /var/www/html/magento1911/$line /var/www/html/puma/$line ;done
@shebin512
shebin512 / Magento1_Snippets.php
Last active September 19, 2020 18:17
My Magento1 Snippets
<?php
//Get Attribute sets
$attribute_sets = Mage::getModel('catalog/product_attribute_set_api')->items();
print_r($attribute_sets);
//get Attributes for a an attibute set
$attributes = Mage::getModel('catalog/product_attribute_api')->items($attributeSetId);
print_r($attributes);
@shebin512
shebin512 / Product_listing_with_skus_magento.phtml
Last active November 18, 2015 07:37
Magento Product Listing using SKUs
<html>
<body>
<?php
/**
* Code to fetch Products in collection and useing SKU's and display the products
*
*/
$pCollection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToFilter(