Skip to content

Instantly share code, notes, and snippets.

View phaelfp's full-sized avatar

Raphael Freitas Pereira phaelfp

View GitHub Profile
@phaelfp
phaelfp / mysql-docker.sh
Created May 17, 2019 13:08 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@phaelfp
phaelfp / M2 acl.xml
Created March 29, 2019 22:39 — forked from Vinai/M2 acl.xml
My current Magento 2 PHPStorm File Templates (Feb 2016)
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
</resource>
</resources>
</acl>
</config>
@phaelfp
phaelfp / install.txt
Created November 21, 2018 10:47
Install Mule Runtime
Como instalar e configurar o Mule Runtime
por Eugene Berman em Transformação Digital , Mulesoft , Dicas e Truques 0 comentários
Mesmo as ferramentas mais fáceis de usar podem ser desafiadoras para instalar e configurar pela primeira vez. Por esse motivo, nossos clientes frequentemente nos pedem as melhores práticas para instalar e configurar o tempo de execução do Mule.
Neste post, compartilho meus aprendizados e minha abordagem para instalar e configurar o tempo de execução do Mule com base em dez anos fazendo isso para a empresa.
Este post é específico para o que recomendamos para a recomendação oficial do RedHat Enterprise CentOS e cobre apenas o tempo de execução do Mule 3.x no local. Não aplicável ao CloudHub ou ao Mule 4.x. A postagem pressupõe que você tenha uma compreensão básica da administração do Linux.
Normalmente, instalar o Mule Runtime em um servidor é uma tarefa trivial, existem algumas práticas recomendadas recomendadas. Aqui está como eu faço isso.
@phaelfp
phaelfp / git-deployment.md
Created September 11, 2018 18:18 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.

@phaelfp
phaelfp / gist:329f3b7e0a4348c1e99010de2e6bcaa7
Created September 4, 2018 14:40
Exemplo de tratamento de exception Mule
<choice-exception-strategy doc:name="Choice Exception Strategy">
<catch-exception-strategy doc:name="Catch Exception Strategy" when="#[exception.causedBy(org.mule.api.transformer.TransformerException)]">
<set-payload doc:name="Set Payload" value="#[payload]">
<jms:outbound-endpoint connector-ref="Active_MQ" doc:name="JMS" queue="Dead.Letter.Invalid.Data">
</jms:outbound-endpoint></set-payload></catch-exception-strategy>
<catch-exception-strategy doc:name="Catch Database Connection Exception" when="#[exception.causedBy(java.sql.SQLException)]">
<set-payload doc:name="Set Payload" value="#[payload]">
<jms:outbound-endpoint connector-ref="Active_MQ" doc:name="JMS" queue="Dead.Letter.Invalid.Data">
</jms:outbound-endpoint></set-payload></catch-exception-strategy>
<catch-exception-strategy doc:name="Catch ActiveMQ Connection Exception" when="#[exception.causedBy(java.lang.Exception)]">
@phaelfp
phaelfp / Dockerfile
Created August 2, 2018 14:08 — forked from alkrauss48/Dockerfile
Running a docker container as a non-root user
# By default, Docker containers run as the root user. This is bad because:
# 1) You're more likely to modify up settings that you shouldn't be
# 2) If an attacker gets access to your container - well, that's bad if they're root.
# Here's how you can run change a Docker container to run as a non-root user
## CREATE APP USER ##
# Create the home directory for the new app user.
RUN mkdir -p /home/app
@phaelfp
phaelfp / magento-address-autocomplete.js
Created July 27, 2018 11:17 — forked from rafaelpatro/magento-address-autocomplete.js
Magento Address Auto Fill based on Postcode
/**
* Address Auto Fill based on Postcode
*
* Author:
* Rafael Patro <[email protected]>
*
* Intallation:
* Add a CMS Static Block applying the entire script below.
* Add a Widget to pages with address forms.
*
@phaelfp
phaelfp / git-update-fork.sh
Created June 12, 2018 10:48 — forked from rdeavila/git-update-fork.sh
Git: como atualizar um fork com as mudanças do original?
#!/bin/bash
# Adicione um novo remote; pode chamá-lo de "upstream":
git remote add upstream https://github.com/usuario/projeto.git
# Obtenha todos os branches deste novo remote,
# como o upstream/master por exemplo:
git fetch upstream
package org.scribe.oauth;
import org.scribe.builder.api.DefaultApi10a;
import org.scribe.model.Token;
/*
* @author jerry
*/
public final class MagentoThreeLeggedOAuth extends DefaultApi10a {
// NOTE as there is no central service for Magento, this does not suit Builder pattern. Must map to your store
# Using Component Grovy
import org.scribe.builder.ServiceBuilder;
import org.scribe.model.*;
import org.scribe.oauth.OAuthService;
import java.util.Scanner;
import org.scribe.oauth.*;
OAuthService service = new ServiceBuilder()