Skip to content

Instantly share code, notes, and snippets.

View avandrevitor's full-sized avatar
😎
A mind that opens up to a new idea never returns to its original size

André Vitor Cuba de Miranda avandrevitor

😎
A mind that opens up to a new idea never returns to its original size
View GitHub Profile
@avandrevitor
avandrevitor / composer.json
Created January 18, 2018 19:35
Build with Composer Scripts
{
"name": "xpto/foo",
"version": "1.0.0",
"description": "Api FooBar",
"type": "project",
"license": "Property",
"authors": [
{
"name": "Andre Vitor Cuba de Miranda",
"email": "avandrevitor@gmail.com"
@avandrevitor
avandrevitor / Dockerfile
Last active January 16, 2018 12:37
LNMP with Docker
FROM php:7.1-fpm
RUN apt-get update -y
RUN apt-get install -y curl zlib1g-dev
RUN docker-php-ext-install mysqli pdo pdo_mysql bcmath zip
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Create User Docker
@avandrevitor
avandrevitor / bootstrap.php
Created January 15, 2018 17:13
Doctrine Bootstrap
<?php
require_once dirname(__DIR__)."/vendor/autoload.php";
define('ROOT_PATH',realpath(dirname(__DIR__)).DIRECTORY_SEPARATOR);
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
$paths = array(ROOT_PATH."src/",ROOT_PATH."metadata/");
$isDevMode = true;
@avandrevitor
avandrevitor / gist:6d1fdf7a4e12ca506945208df11a97d6
Created January 13, 2018 15:54 — forked from rmetzler/gist:2947828
find all non UTF-8 encoded files
find . -type f | xargs -I {} bash -c "iconv -f utf-8 -t utf-16 {} &>/dev/null || echo {}" > utf8_fail
@avandrevitor
avandrevitor / ca.md
Created December 26, 2017 12:12 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

<?php
/**
* Firebird
*/
$dsn = "firebird:dbname=192.168.100.123/3050://firebird/data/database.gdb";
$dsn = "firebird:host=192.168.100.123/3050;dbname=/firebird/data/database.gdb;charset=UTF8";
$pdo = new PDO($dsn,'SYSDBA','masterkey');
/**
@avandrevitor
avandrevitor / docker-compose.yml
Created November 21, 2017 19:30
Docker Composer Mysql-Server Default
version: "2.0"
services:
mysql:
container_name: my-mysql
image: mysql/mysql-server:latest
hostname: my-mysql
working_dir: /data
volumes:
- ./data:/data/
environment:
@avandrevitor
avandrevitor / sanitizer.php
Created November 21, 2017 17:44
Santinizer
<?php
protected function sanitizer($data)
{
if (is_array($data)) {
foreach ($data as &$value) {
$value = $this->sanitizer($value);
}
} else {
$data = mb_convert_encoding($data, "UTF-8", "ISO-8859-1");
@avandrevitor
avandrevitor / Dockerfile
Created October 20, 2017 11:52
Example docker with xdebug & phpstorm
FROM php:5.6.31-fpm
LABEL maintainer="avandrevitor@gmail.com"
RUN apt-get update -y
# Install Depedencies
RUN apt-get install -y \
sudo \
git \
@avandrevitor
avandrevitor / Zsh & theme
Created September 20, 2017 17:07 — forked from leemour/Zsh & theme
Zsh installation and Agnoster theme settings
# Railscast
http://railscasts.com/episodes/308-oh-my-zsh
# Install Zsh
sudo apt-get update && sudo apt-get install zsh
# Install Oh-my-zsh
wget –no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O – | sh
# Make ZSH default shell