Skip to content

Instantly share code, notes, and snippets.

View aldoanizio's full-sized avatar

Aldo Anizio Lugão Camacho aldoanizio

View GitHub Profile
@neeravp
neeravp / nginx.conf
Last active May 17, 2020 20:04
Ngin vhost config file
# Map the Header Accept to the webp format
map $http_accept $webp_suffix {
"~*webp" ".webp";
}
# Path to the directory to store the fastcgi cache files
fastcgi_cache_path /tmp/cache/example levels=1:2 keys_zone=pmquest:23m max_size=1g inactive=60m;
# redirect http to https
server {
listen 80;
@diegofcornejo
diegofcornejo / docker_certbot_manual.sh
Last active February 14, 2022 21:40
Generate Letsencrypt cert using Docker certbot image in manual mode
# Pull docker certbot image
docker pull certbot/certbot
# Create a dir for mount in containers, and save letsencrypt folders
mkdir letsencrypt # or any name you want
# Run a container and follow the instructions
docker run -it --rm -v "$PWD"/letsencrypt:/etc/letsencrypt certbot/certbot certonly --manual -d yourdomain.com
@Mecanik
Mecanik / PHP EV,EVENT, LIBEVENT - Ubuntu 17.10.txt
Created October 1, 2018 16:21
Install PHP EV, EVENT, LIBEVENT on Ubuntu 17.10 for PHP 7.1 (FPM, CLI)
Please use with caution, if you do not understand what these extensions are for, then document yourself first.
PHP LIBEVENT
WARNING: CAUSES SEGEMENTATION FAULT ON PHP 7.0 !
------------------------------------------
cd /usr/src/
git clone https://github.com/expressif/pecl-event-libevent.git
cd pecl-event-libevent
phpize
./configure
@duaneleem
duaneleem / docker-compose.yml
Created January 17, 2018 17:59
This is used to create a local WordPress development using Docker + .htaccess (which is at DuaneLeem.com)
version: '3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
ports:
- "3406:3306"
restart: always
@davidalves1
davidalves1 / formatar_cnpj_cpf.md
Last active May 17, 2024 11:26
Função para formatar CNPJ e CPF, disponível em PHP e JS

PHP

function formatCnpjCpf($value)
{
  $CPF_LENGTH = 11;
  $cnpj_cpf = preg_replace("/\D/", '', $value);
  
  if (strlen($cnpj_cpf) === $CPF_LENGTH) {
    return preg_replace("/(\d{3})(\d{3})(\d{3})(\d{2})/", "\$1.\$2.\$3-\$4", $cnpj_cpf);
  } 
@ghalusa
ghalusa / youtube_id_regex.php
Created June 20, 2015 23:14
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@saleemkce
saleemkce / download_file.php
Created January 24, 2014 18:30
PHP File Download Script - Download large file in chunks.
<?php
/*ini settings*/
set_time_limit(0);
ini_set('memory_limit', '512M');
//DOWNLOAD SCRIPT
$filePath = "G:/Software/versions/..PATH TO DOWNLOAD FILE...zip"; // set your download file path here.
download($filePath); // calls download function
function download($filePath)
{
@prime31
prime31 / gist:5675017
Last active April 2, 2024 03:55
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@kristofferh
kristofferh / git-export
Created December 7, 2011 13:01
"Export" a git repository to zip file
git archive --format zip --output /full/path/to/zipfile.zip master
@prodis
prodis / ramos_de_atividade.txt
Created March 6, 2011 12:14
Lista de ramos de atividade
Alimentos e Bebidas
Arte e Antiguidades
Artigos Religiosos
Assinaturas e Revistas
Automóveis e Veículos
Bebês e Cia
Blu-Ray
Brindes / Materiais Promocionais
Brinquedos e Games
Casa e Decoração