Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🍳
magento 2 ecommerce web stack

MagenX magenx

👨‍🍳
magento 2 ecommerce web stack
View GitHub Profile
@magenx
magenx / gist:9604368
Last active Aug 29, 2015
Clear apc cache
View gist:9604368
#!/bin/bash
myip=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
## 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
done
@magenx
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
View error page
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>error</title>
<style>
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}
View gist:31522a152bd93650022b
$cidrs = array(
'192.168.1.20/27',
'192.168.0.10/32'
);
function cidr_match($ip, $range)
{
list ($subnet, $bits) = explode('/', $range);
$ip = ip2long($ip);
$subnet = ip2long($subnet);
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 Load bad ip addresses to cloudflare api
cat iptocf.txt
27.153.185.20
220.168.125.60
202.101.111.137
.....
#!/bin/bash
View delete_admin.sh
#!/bin/bash
## get n98-magerun2
curl -o /usr/local/bin/magerun2 https://files.magerun.net/n98-magerun2.phar
## 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 gist:07503580876a372b2b54
#!/bin/bash
### System Setup ###
DIRS="/var/www/shop/public_html"
BACKUP=/tmp/backup.$$
NOW=$(date +"%d-%m-%Y")
DELDATE=$(date -d "-7 days" +"%d-%m-%Y")
### MySQL Setup ###
MUSER="xxx"
You can’t perform that action at this time.