Skip to content

Instantly share code, notes, and snippets.

View MarcosBL's full-sized avatar
:octocat:
Github Advocate

MarcosBL MarcosBL

:octocat:
Github Advocate
View GitHub Profile
@MarcosBL
MarcosBL / gist:7178549
Last active July 15, 2023 21:41
Use Dropbox as a Free Webseed for your Torrents

Use Dropbox as a Free Webseed for your Torrents

So, what exactly are we doing?

We are going to upload the file we want to distribute in the "public" Dropbox folder, then use that file's URL as the webseed for a new torrent. Then shut off our computer knowing that our file is well looked-after and you will not receive a stern email from Dropbox.

How to get started

@MarcosBL
MarcosBL / Instrucciones.md
Last active June 13, 2020 22:24
Hack rápido para generar un buscador client-side a partir de una cuenta de Google Drive

Instalación

Hay que poner el código de este index.php en una ruta accesible por el servidor web, que debe soportar php, obviamente. Si por ejemplo lo metemos en una carpetaa /var/www/html/drive debe ser accesible desde http://tu_dominio_o_ip/drive

Además, necesitaremos una versión bastante reciente de rclone, podemos descargarla de https://rclone.org/downloads/

Estas instrucciones son para Linux, pero cualquiera con manejo suelto en windows podrá hacerlo funcionar sin problema.

Configuración

@MarcosBL
MarcosBL / mysqloptimizator.sh
Created January 20, 2014 17:01
Simple MyISAM tables optimization - Just put it on a cron
#!/bin/bash
# Get a list of all fragmented tables
FRAGMENTED_TABLES="$( mysql -e ';use information_schema; SELECT TABLE_SCHEMA,TABLE_NAME FROM TABLES WHERE ENGINE="MyISAM" AND TABLE_SCHEMA NOT IN ("information_schema","mysql") AND Data_free > 0' | grep -v "^+" | sed 's,\t,.,' )"
for fragment in $FRAGMENTED_TABLES; do
database="$( echo $fragment | cut -d. -f1 )"
table="$( echo $fragment | cut -d. -f2 )"
[ $fragment != "TABLE_SCHEMA.TABLE_NAME" ] && echo "Optimizando $fragment" && mysql -e "USE $database; OPTIMIZE TABLE $table;" > /dev/null
done
@MarcosBL
MarcosBL / fuck.py
Created September 24, 2019 23:35
Fuck you deleting Telegram messages after minutes
# NO SIRVE DE NADA BORRAR TU HISTORIAL, seguirá en el canal 48 horas
# disponible para cualquiera que quiera recuperarlo :P
from telethon import TelegramClient, events, sync
from telethon.tl.types import InputChannel, PeerChannel
from telethon.tl.types import Channel
import time
api_id = 'XXXXXX'
api_hash = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
@MarcosBL
MarcosBL / wp-utd.sh
Created September 10, 2019 16:32
Keep Wordpress Up to Date
#!/bin/bash
#
# WP-UTD
# WordPress Up To Date 0.1, May 25 2012
# by Marcos BL; No license, feel free use it
#
# WP-UTD checks all your local WordPress installations are
# up-to-date and notifies you by email if a new version
# is available.
#
@MarcosBL
MarcosBL / php-artisan-bash-completion.md
Created April 3, 2019 01:05
Bash-only Laravel Artisan tab auto-complete

Add the provided code in ~/.bash_profile ( or similarly sourced file ) and you'll get artisan command tab completes on any project on your system:

_artisan()
{
    local arg="${COMP_LINE#php }"

    case "$arg" in
        artisan*)
 COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
@MarcosBL
MarcosBL / PHPExcel_Basics.md
Created January 29, 2019 06:37 — forked from r-sal/PHPExcel_Basics.md
PHPExcel Notes and code snippets

Basics

Creating a new PHPExcel Object.

    $this->PHPExcel = new PHPExcel();

Working with sheets

Creating a new sheet:

@MarcosBL
MarcosBL / gist:fefdd5ba5c3551500ee5
Created March 8, 2015 00:21
A list of domains for disposable and temporary email addresses
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@MarcosBL
MarcosBL / index.html
Last active May 16, 2017 14:07
DomPDF page footers
<html>
<head>
<style>
p { page-break-after: always; }
.footer { position: fixed; bottom: 0px; }
.pagenum:before { content: counter(page); }
</style>
</head>
<body>
<div class="footer">Page: <span class="pagenum"></span></div>
@MarcosBL
MarcosBL / tabs2html.utils.php
Created March 4, 2017 00:25
Tabbed data from textarea conversion to array & nested html
<?php
class Utils
{
public static function tabs2array($list, $indentation = ' ') {
$result = array();
$path = array();
$list = str_replace("\r", "", $list);
foreach (explode("\n", $list) as $line) {
$depth = 0;
while (substr($line, 0, strlen($indentation)) === $indentation) {