Skip to content

Instantly share code, notes, and snippets.

@TheGeekyM
TheGeekyM / ExportableLargeData.php
Last active January 9, 2020 11:29
Export with Laravel DataTables large data
<?php namespace App\DataTables\Concerns;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Response;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
trait ExportableLargeData
{
/**
* @var string
<?php
namespace App\DataTables;
use App\Asset;
use Yajra\DataTables\Services\DataTable;
class AssetsDataTable extends DataTable
{
/**
@jagdeepsingh
jagdeepsingh / README.md
Last active September 21, 2023 11:57
Set up macOS High Sierra 10.13.6

Set up macOS High Sierra 10.13.6

Open the terminal and type git. If it not installed, you will see a dialog box with a button to install it. Click on the button and git will be installed in a couple of minutes.

$ git --version
git version 2.15.2 (Apple Git-101.1)
@mafonso
mafonso / list-all-access-keys.sh
Last active October 10, 2023 05:19
List Access Keys for all IAM users
for user in $(aws iam list-users --output text --no-cli-pager | awk '{print $NF}'); do
aws iam list-access-keys --user $user --output text --no-cli-pager
test $? -gt 128 && exit
done
@masakielastic
masakielastic / benchmark.php
Last active February 10, 2022 07:37
random_int vs mt_rand
<?php
function timer(callable $block) {
$start = microtime(true);
for ($i = 0; $i < 100000; ++$i) {
$block();
}
$end = microtime(true);
return $end - $start;
}
@winok
winok / gist:6153500
Last active September 28, 2020 08:03
PHP SHA1WithRSA sign/verfiy
<?php
## openssl genrsa -out key.pem 1024
## openssl rsa -in key.pem -pubout -outform PEM -out pubkey.pem
## openssl rsa -in key.pem -pubout -outform DER -out pubkey.der
function hextobin($hexstr)
{
$n = strlen($hexstr);
$sbin="";