Skip to content

Instantly share code, notes, and snippets.

#!/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
<?php
//
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio)
//
// https://gist.github.com/levelsio/6ee6c47283ee414ef3aace1d81986717
//
// File: twitterFollowerCuratorBot.php
//
// Created: May 2021
#!/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 March 18, 2021 09:38
Clean all git repositories from a base path
#!/bin/bash
e () {
echo -e "$(date '+%Y-%m-%d %H:%M:%S'): $1"
}
echo ""
BASE="$1"
<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 December 24, 2020 13:55
Download PHP appendices with versions changes
<?php
/**
* @param string $html
*
* @return \DOMDocument
*/
function dom(string $html): DOMDocument
{
libxml_use_internal_errors(true);
@eusonlito
eusonlito / postgresql-stats.sql
Last active December 11, 2020 09:55
List all postgresql tables with rows, contents size, index size and total size
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')
@eusonlito
eusonlito / stats.sh
Last active November 12, 2020 18:07
#!/bin/bash
set -euo pipefail
function awsSort {
awk '{
for(i=1; i<=NF; ++i)
if ($i ~ /^(time|memory|cpu)=/) {
split($i, f, "=");
@eusonlito
eusonlito / App-Providers-Debug.php
Created October 17, 2020 15:18
Laravel Mail Logger
<?php declare(strict_types=1);
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Services\Mail\Logger as LoggerMail;
class Debug extends ServiceProvider
{
/**
@eusonlito
eusonlito / App-Providers-Debug.php
Created October 15, 2020 09:57
Laravel Database Logger
<?php declare(strict_types=1);
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Services\Database\Logger as LoggerDatabase;
class Debug extends ServiceProvider
{
/**