Skip to content

Instantly share code, notes, and snippets.

View dgoguerra's full-sized avatar

Diego Guerra dgoguerra

View GitHub Profile
<?php
namespace App\Traits;
use App\Entities\User;
use DateTime;
use GuzzleHttp\Psr7\Response;
use Illuminate\Events\Dispatcher;
use Laravel\Passport\Bridge\AccessToken;
use Laravel\Passport\Bridge\AccessTokenRepository;
@dgoguerra
dgoguerra / logslaravel.sh
Created August 20, 2018 07:20 — forked from jakebathman/logslaravel.sh
Tail Laravel logs and filter out the stack traces
tail -f -n 450 storage/logs/laravel*.log \
| grep -i -E \
"^\[\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}\]|Next [\w\W]+?\:" \
--color
@dgoguerra
dgoguerra / Mac OSX Setup - Brew
Created November 5, 2018 19:01 — forked from jbelke/Mac OSX Setup - Brew
Mac OSX Setup - Brew and Cask
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
# Install Xcode first - https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12
# Install Xcode command line tools.
xcode-select --install
@dgoguerra
dgoguerra / mysql-query-log.md
Created November 22, 2018 08:43
MySQL general query log

## When you have SUPER privileges

# enable query log
SET GLOBAL general_log = 'ON';
SET GLOBAL log_output = 'TABLE';

# disable query log
SET GLOBAL general_log = 'OFF';
@dgoguerra
dgoguerra / mysql-query-log.md
Last active November 22, 2018 08:44
MySQL general query log

When you have SUPER privileges

# enable query log
SET GLOBAL general_log = 'ON';
SET GLOBAL log_output = 'TABLE';

# disable query log
SET GLOBAL general_log = 'OFF';
@dgoguerra
dgoguerra / instance-metadata.md
Created November 26, 2018 13:18
Instance metadata of an EC2 instance (AWS acount ID, region, etc)
curl http://169.254.169.254/latest/dynamic/instance-identity/document
@dgoguerra
dgoguerra / libsodium.md
Last active November 10, 2021 02:10
Install libsodium in PHP 7
@dgoguerra
dgoguerra / RestartDatabase.php
Last active May 17, 2019 12:43
Restart and migrate database once before all phpunit tests. Optionally, use a tratit to restart between each test.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class RestartDatabase extends Command
{
/**
@dgoguerra
dgoguerra / ngrok-rewrite-host-header.md
Created May 30, 2019 21:55
Ngrok rewrite host header
ngrok http -host-header=rewrite site.dev:80
@dgoguerra
dgoguerra / keybase.md
Created August 28, 2019 19:21
Keybase proof

Keybase proof

I hereby claim:

  • I am dgoguerra on github.
  • I am dgoguerra (https://keybase.io/dgoguerra) on keybase.
  • I have a public key ASCsYWW7qgQFJRPGlbFpV_-WXA_jShwnI1sQ283-_b-yKgo

To claim this, I am signing this object: