Skip to content

Instantly share code, notes, and snippets.

View guilhermewop's full-sized avatar
😎
Coders gonna code

Guilherme Pereira guilhermewop

😎
Coders gonna code
View GitHub Profile
@guilhermewop
guilhermewop / mailer.rb
Created March 23, 2020 16:44 — forked from max/mailer.rb
A simple Ruby script to send mass emails
require 'mail'
require 'csv'
FILE = ARGV[0]
Mail.defaults do
delivery_method :smtp, {
address: '',
port: 587,
domain: '',
user_name: '',
@guilhermewop
guilhermewop / set_gnome-terminal_transparency.sh
Created January 12, 2019 17:57 — forked from nirbheek/set_gnome-terminal_transparency.sh
A tiny script to set the transparency for X windows. If AUTOMAGIC_MODE is "true", it tries to find all gnome-terminal windows and applies the transparency to all of them.
#!/bin/bash
# vim: set sts=4 sw=4 et tw=0 :
#
# License: BSD
AUTOMAGIC_MODE="true"
OPACITY_100="0xffffffff"
OPACITY_0="0x0"
: ${XWININFO:=$(type -P xwininfo)}
@guilhermewop
guilhermewop / php-fpm-7.1_apache_ubuntu.sh
Last active November 6, 2017 03:56
High-performance PHP 7.1 (with php-fpm and mysqlnd) on Apache 2.4 worker (with mod_proxy_fcgi) on Ubuntu
sudo apt-get update -y && apt-get upgrade -y
sudo apt-get install vim \
git \
tree \
libldap2-dev \
libldap-2.4-2 \
libtool-bin \
libzip-dev \
lbzip2 \
@guilhermewop
guilhermewop / filesystem-simulator.py
Created January 23, 2017 19:22
filesystem-simulator.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
class SistemaDeArquivo:
def __init__(self, nome, tamanho = 0):
self.nome = nome
self.tamanho = tamanho
def get_nome(self):
return self.nome
@guilhermewop
guilhermewop / contador-de-letras.php
Last active February 1, 2016 11:48
Contador de Letras
<?php
/**
* Conta a quantidade de letras de uma determinada palavra
*
* @param $palavra String Palavra a ser analisada pelo contador
* @param $letras Array|String Letras que deseja contar na palavra
* @throws InvalidArgumentException Lança exceção caso não passe pelo menos uma letra para contar na palavra
* @return Int Quantidade de ocorrências de $letras na $palavra
*/
function contarLetras($palavra, $letras = ['a', 'e', 'i', 'o', 'u'])
@guilhermewop
guilhermewop / apigility-client-example.php
Last active August 29, 2015 14:22
Apigility client usage
<?php
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class IndexController extends AbstractActionController
{
public function indexAction()
{
@guilhermewop
guilhermewop / zf2-vhost.conf
Last active August 29, 2015 14:13
Zend Framework 2 Apache virtual host
<VirtualHost *:80>
ServerName application.local
DocumentRoot <application-path>/public
SetEnv APPLICATION_ENV development
<Directory <application-path>/public>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
@guilhermewop
guilhermewop / .htaccess
Created December 22, 2014 18:02
Zend Framework 2 htaccess
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
@guilhermewop
guilhermewop / zf2_restrict_login.php
Last active August 29, 2015 13:57
Zend Framework 2. Restringe o acesso às páginas fora da white list. Útil para controlar login. Use no Module::onBootstrap
<?php
/**
* Restringe o acesso às páginas fora da white list. útil para controlar login.
*
* @param Zend\Mvc\MvcEvent $e Instância
* @param Mixed $authService Instância do serviço de autenticação
* @param Array $whiteListRoutes Lista de rotas na white list (Sem precisar de login)
* @param String $loginRoute Nome da rota para o login
* @link http://stackoverflow.com/questions/14137868/zend-framework-2-global-check-for-authentication-with-zfcuser
@guilhermewop
guilhermewop / vagrant-centos.md
Created February 7, 2014 15:03
CentOS Vagrant

Vagrant de desenvolvimento CentOS 6.3 LAMP

vagrant box add centos-6.3 https://s3.amazonaws.com/itmat-public/centos-6.3-chef-10.14.2.box
mkdir vagrant-lamp
vagrant init centos-6.3