Skip to content

Instantly share code, notes, and snippets.

View danielpereirabp's full-sized avatar

Daniel Pereira danielpereirabp

View GitHub Profile
@danielpereirabp
danielpereirabp / swap
Last active March 16, 2016 01:50
Create a Swap File
sudo dpkg-reconfigure tzdata
sudo apt-get update
sudo apt-get install ntp
free
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
cd /home/forge/default
git pull origin master
composer install --no-interaction --no-dev --prefer-dist
composer update fzaninotto/faker --no-interaction --dev --prefer-dist
php artisan migrate:reset
php artisan migrate --force
php artisan db:seed
npm cache clean
npm install
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_PROXY, 'http://user:[email protected]:3128');
@danielpereirabp
danielpereirabp / AppCoreExtension.php
Last active June 16, 2016 14:47
Symfony2 Custom Configuration
<?php
/**
* application/src/App/CoreBundle/DependencyInjection/AppCoreExtension.php
*
*/
namespace App\CoreBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
@danielpereirabp
danielpereirabp / git.txt
Created September 28, 2016 11:35 — forked from armoucar/git.txt
comandos git
Instalação do GIT no ubuntu:
sudo apt-get install git-core git-svn ssh gitk
ssh-keygen -t rsa
git config --global user.name "Arthur Moura Carvalho"
git config --global user.email "[email protected]"
git config --global color.status "auto"
git config --global color.branch "auto"
git config --global color.interactive "auto"
git config --global color.diff "auto"
@danielpereirabp
danielpereirabp / groupby.es
Created January 25, 2017 10:47
Elasticsearch Group By
POST /questoes_sf/questao/_search
{
"size": 0,
"query": {
"term": {
"instituicao.dominio": "na"
}
},
"aggs": {
"group_by_comparador": {
@danielpereirabp
danielpereirabp / git-lf-clrf
Created July 20, 2017 12:37
Disable “LF will be replaced by CLRF” warning in Git on Windows
If you’ve ever used Git in windows, you may have seen something like this every time you add files to Git:
warning: LF will be replaced by CRLF in www/index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in www/templates/dash.html.
The file will have its original line endings in your working directory.
If you want to turn it off, type this:
git config --global core.safecrlf false
@danielpereirabp
danielpereirabp / trigger_check_create_order.sql
Last active February 28, 2018 17:42
Create trigger to stop insert
CREATE TABLE orders (
id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
total DECIMAL(8,2) NOT NULL,
delivery_date DATE NOT NULL,
status SMALLINT(6) NOT NULL DEFAULT '0',
client_id INT(10) UNSIGNED NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
  1. Setup Your Socks Proxy

ssh -D 127.0.0.1:1080 [email protected] -p 2002

  1. Add The Proxy to Your SSH Config

Add this to your ~/.ssh/config:

Host bitbucket.org IdentityFile ~/.ssh/gitkey

@danielpereirabp
danielpereirabp / nginx-proxy
Created June 22, 2018 19:19
Nginx Proxy - SPA (Vue 2) + API/ADMIN (Laravel 5.6)
server {
listen 80;
server_name domain.com.br;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8181;