Skip to content

Instantly share code, notes, and snippets.

View cagartner's full-sized avatar

Carlos Augusto Gartner cagartner

View GitHub Profile

Usage

If you need to add more items to the CSP go to the line 36 and add more items inside the object.

Here I used as an example the font-src. In this case I just needed to add 1 more URL, so I added a string to the font-src key.

If you need to add more than 1 item you can use the value as an array. Also, if you need to add more keys, just add it to the object, like this:

updateContentSecurityPolicy(definitions, {
@rafaelstz
rafaelstz / magedeploy.sh
Created May 12, 2020 21:35
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)
#!/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
@shinesoftware
shinesoftware / fix-duplicates-product-entity-varchar.php
Last active August 20, 2021 14:10
Magento 2: Reindex Error - 1062 Duplicate entry `catalog_product_index_eav_temp` (?, ?, ?, ?, ?)...
<?php
$conn = mysqli_connect("HOST", "USER", "PASS", "DATABASE");
if (!$conn) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
@rafaelstz
rafaelstz / 1step-Install-Deployer-Magento2-BitbucketPipelines.md
Last active April 4, 2024 18:52
Automated deploy using Magento 2 + Bitbucket Pipelines + Deployer

Use both files in your root folder and run:

curl -LO https://deployer.org/deployer.phar && sudo mv deployer.phar /usr/local/bin/dep && sudo chmod +x /usr/local/bin/dep
composer require deployer/recipes --dev
composer require rafaelstz/deployer-magento2 dev-master --dev
@butschster
butschster / debian-laravel.sh
Last active June 17, 2022 10:24
LEMP server configured for Laravel (MySQL, NGINX, php7.2-fpm, Redis, Websocket server, MongoDB, Composer)
# ================================================
# PHP 7.2
#
# See https://www.colinodell.com/blog/201711/installing-php-72
# ================================================
apt-get install -y apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
apt-get update
apt-get install -y php7.2-cli php7.2-gd php7.2-mbstring php7.2-curl php7.2-xml php7.2-zip
@dannygsmith
dannygsmith / valet-plus-destroy
Last active July 18, 2023 09:07
Remove valet-plus - reboot required
#!/usr/bin/env bash
#styles
VP_NONE='\033[00m'
VP_RED='\033[01;31m'
VP_GREEN='\033[01;32m'
VP_YELLOW='\033[01;33m'
VP_PURPLE='\033[01;35m'
VP_CYAN='\033[01;36m'
VP_WHITE='\033[01;37m'
@bgarrant
bgarrant / ValetSwitchPHP.md
Last active September 30, 2022 08:08
How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

Valet switch PHP version with these commands

Install PHP 5.6 and switch Valet to PHP 5.6

valet stop
brew unlink php71
brew install php56
brew install php56-mcrypt
@spinsch
spinsch / Magento1ValetDriver.php
Last active October 29, 2019 11:43
Laravel Valet Driver for Magento 1
<?php
/*
* Magento 1 Valet Driver
* @author spinsch
* @path ~/.valet/Drivers/Magento1ValetDriver.php
*/
class Magento1ValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
@mtbottens
mtbottens / notreallyimportant.sh
Last active February 27, 2024 11:38
Easily update, import and sanitize magento2 cloud databases
function m2-update-database() {
# USAGE
# m2-update-database 'Magento Cloud Project Title' 'http://project.dev/'
# $1 = Project Title
# $2 = Local URL
# Get the project ID by the project title
PROJECT_ID=$(magento-cloud project:list --title=$1 --pipe)
GIT_BRANCH_NAME=$(git branch | grep \* | cut -d ' ' -f2)