Skip to content

Instantly share code, notes, and snippets.

View 01-ab.sh
#!/bin/bash
set -e
URL="http://localhost/laravel/public/test"
rm -rf vendor storage/logs/*.log
composer install --no-scripts --no-dev && composer install --no-dev --optimize-autoloader --classmap-authoritative
View twitterFollowerCuratorBot.php
<?php
//
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio)
//
// https://gist.github.com/levelsio/6ee6c47283ee414ef3aace1d81986717
//
// File: twitterFollowerCuratorBot.php
//
// Created: May 2021
View install-server-nginx-php-mysql.sh
#!/bin/bash
if [ "`whoami`" != 'root' ]; then
echo ""
echo "This script only can be executed by root"
echo ""
exit 1
fi
@eusonlito
eusonlito / git-gc.sh
Last active Mar 18, 2021
Clean all git repositories from a base path
View git-gc.sh
#!/bin/bash
e () {
echo -e "$(date '+%Y-%m-%d %H:%M:%S'): $1"
}
echo ""
BASE="$1"
View exit.html
<a href="https://google.es" id="salida">Google!</a>
<script>
var a = document.getElementById('salida');
a.addEventListener('click', function(e) {
e.preventDefault();
window.open(a.href, '_blank').focus();
window.location.replace(a.href);
@eusonlito
eusonlito / download.php
Created Dec 24, 2020
Download PHP appendices with versions changes
View download.php
<?php
/**
* @param string $html
*
* @return \DOMDocument
*/
function dom(string $html): DOMDocument
{
libxml_use_internal_errors(true);
@eusonlito
eusonlito / postgresql-stats.sql
Last active Dec 11, 2020
List all postgresql tables with rows, contents size, index size and total size
View postgresql-stats.sql
SELECT N.nspname || '.' || C.relname AS "relation",
S.n_live_tup AS "rows",
pg_size_pretty(pg_relation_size(C.oid)) AS "data_size",
pg_size_pretty(pg_indexes_size(C.oid)) AS "index_size",
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
FROM pg_class C
LEFT JOIN pg_namespace AS N ON (N.oid = C.relnamespace)
LEFT JOIN pg_stat_user_tables S ON (S.relname = C.relname)
WHERE (
N.nspname NOT IN ('pg_catalog', 'information_schema')
View stats.sh
#!/bin/bash
set -euo pipefail
function awsSort {
awk '{
for(i=1; i<=NF; ++i)
if ($i ~ /^(time|memory|cpu)=/) {
split($i, f, "=");
View App-Providers-Debug.php
<?php declare(strict_types=1);
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Services\Mail\Logger as LoggerMail;
class Debug extends ServiceProvider
{
/**
View App-Providers-Debug.php
<?php declare(strict_types=1);
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Services\Database\Logger as LoggerDatabase;
class Debug extends ServiceProvider
{
/**