Skip to content

Instantly share code, notes, and snippets.

@angelflo
angelflo / my.cnf
Created January 30, 2018 09:09 — forked from yvoronoy/my.cnf
MySQL Magento Config
[mysqld]
## After edit config you have to remove log files and restart mysql server
## because after changing innodb-log-file-size you should recreate ib_logfiles
## Stop MySQL server
## rm /data/dir/ib_logfile*
## Run MySQL server
##Table open cache under MacOS and MySQL 5.6 should be 250.
##Otherwise you will get error MySQL server has gone away
##table-open-cache = 250
@angelflo
angelflo / ipset-country
Created February 5, 2018 07:20 — forked from mkorthof/ipset-country.md
Block countries using iptables + ipset + ipdeny.com
#!/bin/sh
# ipset-country
# Block countries using iptables + ipset + ipdeny.com
# run this script from cron, e.g. /etc/cron.daily
# to run on boot you can also add it to e.g. /etc/rc.local
# please note: this script will insert an iptables REJECT
@angelflo
angelflo / countries_block.sh
Created February 5, 2018 07:34
IPSet block country
#!/bin/bash
# Description: Uses IPSET and IPTABLES to block full countries from accessing the server for all ports and protocols
# Syntax: countries_block.sh countrycode [countrycode] ......
# Use the standard locale country codes to get the proper IP list. eg.
# countries_block.sh cn ru ro
# Will create tables that block all requests from China, Russia and Romania
# Note: To get a sorted list of the inserted IPSet IPs for example China list(cn) run the command:
# ipset list cn | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4
# #############################################################################
# Defining some defaults
@angelflo
angelflo / ElephantData.php
Created March 23, 2018 16:40 — forked from kanduvisla/ElephantData.php
Observer to strip <p> tags for Magento 2 in pages and static blocks
<?php
namespace Elephant\CFParent\Helper;
class ElephantData extends \Magento\Framework\App\Helper\AbstractHelper
{
public function __construct(
\Magento\Framework\App\Helper\Context $context,
array $data = []
@angelflo
angelflo / letsencrypt_2018.md
Created December 14, 2018 07:25 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@angelflo
angelflo / restart-service.sh
Created June 1, 2019 04:37 — forked from fer-ri/restart-service.sh
Auto Restart PHP5-FPM When Down or Bad Gateway
#!/bin/bash
if curl --head -sf http://yourdomain.com/some-script.php -o /dev/null; then
echo "PHP FPM is up"
else
service php5-fpm restart && service nginx restart && service mysql restart
echo "Opps .. service was down" | mail -s "PHP-FPM Service Down" [email protected] -aFrom:[email protected]
fi
@angelflo
angelflo / cloud-sql-proxy.service
Created June 11, 2019 03:08 — forked from goodwill/cloud-sql-proxy.service
Example Systemd file for starting cloud sql proxy at system start
[Install]
WantedBy=multi-user.target
[Unit]
Description=Google Cloud Compute Engine SQL Proxy
Requires=networking.service
After=networking.service
[Service]
Type=simple
@angelflo
angelflo / Firewalld GeoIP firewall script
Created July 15, 2019 14:26 — forked from Pandry/Firewalld GeoIP firewall script
Block countries IPs via Firewalld
#!/bin/bash
##
# Name: GeoIP Firewall script
# Author: Pandry
# Version: 0.1
# Description: This is a simple script that will set up a GeoIP firewall blocking all the zones excecpt the specified ones
# it is possible to add the whitelisted zones @ line 47
# Additional notes: Usage of [iprange](https://github.com/firehol/iprange) is suggested
# for best performances
@angelflo
angelflo / Robots.txt
Created October 27, 2019 16:10 — forked from rafaelstz/Robots.txt
Robots.txt Magento 2
# Directories & files
Disallow: /wishlist/
Disallow: /customer/
Disallow: /checkout/
Disallow: /catalog/
Disallow: /catalogsearch/
Disallow: /downloader/
Disallow: /braintree/
Disallow: /order/
Disallow: /rma/
@angelflo
angelflo / gist:44ff6d266909e86618046c0d9f9538fd
Created December 5, 2019 06:26 — forked from paugnu/gist:1eb7045d660ebe61e51987554e3a1450
Owebia configuration for product shipping restriction
{
"envio_AD": {
"label": "Andorra",
"description": "Envío normal Andorra",
"shipto": "AD",
"conditions": "{skus_es_only.conditions} && {cart.free_shipping}!='true'",
"fees": "{table {cart.weight} in 5.0100:5.5100,10.0100:5.5100,15.0100:6.9200,20.0100:8.0000,25.0100:10.4500,30.0100:11.3400,35.0100:11.3400,40.0100:11.3400,45.0100:11.3800,50.0100:12.4100,60.0100:13.4400,70.0100:15.5000,80.0100:17.5700,90.0100:19.3000,100.0100:21.0200,110.0100:22.7500,120.0100:27.0700,130.0100:27.0700,140.0100:31.3900,150.0100:31.3900,160.0100:35.7100,170.0100:35.7100,180.0100:39.0800,190.0100:39.0800,10000.0000:39.0800}"
},
"envio_EU1": {
"label": "Países: AT, BG, CH, CY, CZ, DK, EE, FI, GR, HU, IE, IS, IT, LI, LT, LU, LV, MC, MT, NO, PL, RO, SK, SI, SE",