Skip to content

Instantly share code, notes, and snippets.

magento 2 ecommerce web stack

MagenX magenx

magento 2 ecommerce web stack
View GitHub Profile
View gist:07503580876a372b2b54
### System Setup ###
NOW=$(date +"%d-%m-%Y")
DELDATE=$(date -d "-7 days" +"%d-%m-%Y")
### MySQL Setup ###
## get n98-magerun2
curl -o /usr/local/bin/magerun2
## reset magento admin password
MAGE_NEW_ADMIN_PASS="$(head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9!@#$%^&?=+_[]{}()<>-' | fold -w 15 | head -n 1)${RANDOM}"
read -e -p "---> Enter admin old login: " -i "admin" MAGE_OLD_ADMIN_NAME
View Load bad ip addresses to cloudflare api
cat iptocf.txt
View gist:20d7aeb0ebda73eda6f3
Option Meaning
-h, --help Show this message
-l, --status List/Show iptables configuration
-l6, --status6 List/Show ip6tables configuration
-s, --start Start firewall rules
-f, --stop Flush/Stop firewall rules (Note: lfd may restart csf)
-r, --restart Restart firewall rules
-q, --startq Quick restart (csf restarted by lfd)
-sf, --startf Force CLI restart regardless of LFDSTART setting
-a, --add ip Allow an IP and add to /etc/csf.allow
View gist:31522a152bd93650022b
$cidrs = array(
function cidr_match($ip, $range)
list ($subnet, $bits) = explode('/', $range);
$ip = ip2long($ip);
$subnet = ip2long($subnet);
View error page
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
body {background:#eee;font-size:1em;line-height:1.3;font-family:arial,sans-serif;}
.error {position:relative;width:530px;margin:50px auto;padding:20px 40px;background:#fff;border:10px solid #e0e0e0;box-shadow:0 2px 8px -6px rgba(0,0,0,.2);border-radius:10px;text-align:center}
magenx / gist:9604368
Last active Aug 29, 2015
Clear apc cache
View gist:9604368
myip=$(curl -s
## monitor app folder and clear apc/opcode cache
/usr/bin/inotifywait -e modify \
-mrq /var/www/html/magento/app | while read line; do
echo -n "$line " >> /var/log/app_monitor.log
echo `date | cut -d " " -f1-4` >> /var/log/app_monitor.log
wget -O /dev/null http://$myip/apc_opcache/apc_clear.php >/dev/null 2>&1
magenx / gist:9604286
Created Mar 17, 2014
Get firewall messages sorted
View gist:9604286
grep Firewall messages | sed -r 's/.*SRC=(\S+).*PROTO=(\S+).*DPT=(\S+).*/\1 \2 \3/' | sort | uniq -c | sort -r -n
You can’t perform that action at this time.