Skip to content

Instantly share code, notes, and snippets.


Dan Alvidrez bayareawebpro

Block or report user

Report or block bayareawebpro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
paragonie-scott /
Last active Oct 22, 2019
String Encryption in JavaScript and PHP

Just for fun, let's encrypt some stuff in client-side JavaScript and have a PHP server decrypt it. Note that this will never replace TLS (HTTPS).

JavaScript Encryption with Sodium-Plus

You'll want the latest release of sodium-plus for this. (As of this writing, it's version 0.4.0.)

krakjoe / crawler.php
Last active Jan 30, 2020
parallel Futures, Channels (buffered, unbuffered, synchros), Events using parallel producer/consumer pattern
View crawler.php
use \parallel\{Runtime, Future, Channel, Events};
/* usage php crawler.php [] [workers=8] [limit=500] */
$page = $argv[1] ?: ""; # start crawling this page
$workers = $argv[2] ?: 8; # start this number of threads
$limit = $argv[3] ?: 500; # stop at this number of unique pages
$timeout = $argv[4] ?: 3; # socket timeout for producers
jhm-ciberman / NovaResourcesTest.php
Created Apr 28, 2019
Simple Automatic Test for Laravel Nova Resources
View NovaResourcesTest.php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Request;
use Laravel\Nova\Nova;
use Laravel\Nova\Resource;
tigusigalpa / database.php
Last active Jan 30, 2020
Laravel PostgreSQL SSL encryption connection config
View database.php
* 1. You have to store your client SSL certificates on your Laravel server, in my case this is /var/certs/
* 2. You have to right select SSL mode for PostgreSQL (see, verify-full means your server CA is signed for real domain name for the PostgreSQL server (recommended)
* 3. Go to Laravel config/database.php to the section 'pgsql' and extend it to the following:
return [
'connections' => [
/*'mysql' etc*/
connerbw / EventEmitter.php
Last active Jan 11, 2019
Refactor Your Slow Form Using PHP Generators and Event Streams
View EventEmitter.php
* @license GPLv3 (or any later version)
* @see
namespace KIZU514;
class EventEmitter
View larg_tables.sql
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC
ankurk91 /
Last active Feb 19, 2020
Laravel Horizon, redis-server, supervisord on Ubuntu server

Laravel Horizon, redis-server, supervisord on Ubuntu 16/18 server

Laravel 6.0, Horizon 3.x, Redis 5.x

Parepare application

  • Install and configure Laravel Horizon as instructed in docs
  • Make sure you can access the Horizon dashboard like -
  • For now it should show status as inactive on dashbaord

Install redis-server

View CommandEventsListener.php
namespace App;
use Closure;
class CommandEventsListener
protected $startCallbacks = [];
protected $finishCallbacks = [];
giansalex /
Last active Feb 20, 2020
docker-php-ext-install Reference
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN docker-php-ext-install mcrypt
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
You can’t perform that action at this time.