Skip to content

Instantly share code, notes, and snippets.

Avatar

Ennio Sousa enniosousa

View GitHub Profile
@enniosousa
enniosousa / nps-auto.sh
Created Aug 3, 2020
Install Google Pagespeed Module on Nginx running on aaPanel
View nps-auto.sh
#!/bin/bash
Green_font="\033[32m" && Yellow_font="\033[33m" && Red_font="\033[31m" && Font_suffix="\033[0m"
Info="${Green_font}[Info]${Font_suffix}"
Error="${Red_font}[Error]${Font_suffix}"
NGX_DIR=/www/server/nginx
NPS_VESION=1.13.35.2-stable
echo -e "${Green_font}
#=======================================
# Project: nps-auto
@enniosousa
enniosousa / clean-header.php
Last active Jul 26, 2020
Clear Wordpress head removing meta tags, styles and scripts
View clean-header.php
<?php
/*
* Name: wordpress assist clean header
* Source: https://gist.github.com/Auke1810/f2a4cf04f2c07c74a393a4b442f22267
* Date: 2020-07-25
*/
remove_action('wp_head', 'rsd_link'); // remove really simple discovery link
remove_action('wp_head', 'wp_generator'); // remove wordpress version
@enniosousa
enniosousa / git-update-fork.sh
Created Sep 30, 2019 — forked from rdeavila/git-update-fork.sh
Git: como atualizar um fork com as mudanças do original?
View git-update-fork.sh
#!/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
View mkcert.md

Instalar

Instruções de como instalar aqui https://github.com/FiloSottile/mkcert

Converter Root Certificate Autorirarity (do arquivo .pem para .pfx, ou outros

No Ubuntu o root CA gerado é no arquivo .pem, e o Windows não aceita este formato, por isso usar o .pfx. O site sslshopper.com faz isto online, mas é recomendado fazer pelo openssl.

cd ~/.local/share/mkcert
openssl pkcs12 -export -out rootCA.pfx -inkey rootCA-key.pem -in rootCA.pem

Baixe o arquivo rootCA.pfx gerado para importação no Windows.

@enniosousa
enniosousa / Laravel Authentication with MD5 Hasher instead of Bcrypt.md
Last active Apr 12, 2021
Laravel Authentication with MD5 Hasher instead of Bcrypt
View Laravel Authentication with MD5 Hasher instead of Bcrypt.md

Tested with Laravel 5.8

1. Create the class Md5Hasher into folder app/Hashers

<?php

namespace App\Hashers;

use Illuminate\Contracts\Hashing\Hasher;
@enniosousa
enniosousa / 1. Install Ubuntu Web Server.md
Last active Jan 6, 2020
Install LAMP (Linux Apache MySQL and PHP 7.3), Composer and SQL Server PHP PDO Driver
View 1. Install Ubuntu Web Server.md
View 1. Install code-server.md

1. Instalação

Tutorial para Digital Ocean

2. Apache (Opcional)

Últil quando se tem apenas a porta 80 ou 443 liberada

Criar o virtual host com reverse proxy

Use o comando abaixo para criar o arquivo

@enniosousa
enniosousa / laravel-nearby-locations-query-scope.php
Created Sep 26, 2018 — forked from stevenmaguire/laravel-nearby-locations-query-scope.php
Laravel (Illuminate) query builder scope to list neighboring locations within a given distance from a given location
View laravel-nearby-locations-query-scope.php
<?php
/**
* Query builder scope to list neighboring locations
* within a given distance from a given location
*
* @param Illuminate\Database\Query\Builder $query Query builder instance
* @param mixed $lat Lattitude of given location
* @param mixed $lng Longitude of given location
* @param integer $radius Optional distance