Skip to content

Instantly share code, notes, and snippets.

View esilvajr's full-sized avatar

Edison Silva Jr esilvajr

  • Arquivei
  • Jaboticabal/São Carlos, SP
View GitHub Profile
<html>
<head>
<title>Hello PHP Form</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<style type="text/css">
<!--
body {
background: #eee !important;
}
@esilvajr
esilvajr / latest-widevine.sh
Created February 9, 2017 12:06 — forked from ruario/intro-latest-widevine.md
Fetches Chrome and extracts out Widevine so that it can be used by Vivaldi. Also works with other Chromium-based browsers, see guide below.
#!/usr/bin/env bash
available () {
command -v $1 >/dev/null 2>&1
}
# Make sure we have wget or curl
if available wget; then
SILENT_DL="wget -qO-"
LOUD_DL="wget"
<?php
class Connect
{
private $host = "127.0.0.1"; //localhost
private $database = "academia_hello_php";
private $username = "root";
private $password = "root";
private $driver = "mysql";
// Configuração
// Método 1
// Você pode definir suas credenciais de acesso, entre outras configurações, editando o arquivo
// PagSeguroLibrary/config/PagSeguroConfig.php
$PagSeguroConfig = array();
$PagSeguroConfig['environment'] = "production"; // production, sandbox
$PagSeguroConfig['credentials'] = array();
$PagSeguroConfig['credentials']['email'] = "your_pagseguro_email";
$PagSeguroConfig['credentials']['token']['production'] = "your_production_pagseguro_token";

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

@esilvajr
esilvajr / escape_eloquent.php
Last active May 26, 2017 21:55
search with \\ escape in laravel eloquent in mysql
<?php
$name = "Léo";
$name = json_encode($name);
if (strpos($name, '\\u00') !== false) {
//the first bar is the escape and the second is the real bar
//so we have one bar in search
//and in replace 8 bars, because laravel will scape this bars again and we need 4 to select works in mysql :)

Lumen and naming transactions into NewRelic

Problem: How to build transaction name for NewRelic in Lumen.

Description: NewRelic tries to group similar transaction into group, to be able easier watch for them later on Extra-Problem: NewRelic has an issue and becuase of that they can not group following transactions:

  • /orders/zzZfN0kZ6F1PtFdQ4Baq
  • /orders/aaZDd0k43D1GtFeG5cCe ...
@esilvajr
esilvajr / mysql-docker.sh
Created September 11, 2017 13:02 — 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
@esilvajr
esilvajr / Makefile
Created August 21, 2017 12:01 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config
configfile=config.env
ifdef cnf
configfile=$(cnf)
endif
include $(configfile)
export $(shell sed 's/=.*//' $(configfile))
# import deploy config
deployfile=deploy.env
@esilvajr
esilvajr / install.sh
Created September 10, 2018 22:33 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`