Skip to content

Instantly share code, notes, and snippets.

👨‍🍳
Deploying Auto-Scalable Magento Cluster

MagenX magenx

👨‍🍳
Deploying Auto-Scalable Magento Cluster
Block or report user

Report or block magenx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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"
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 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(
'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 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}
@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
You can’t perform that action at this time.