Skip to content

Instantly share code, notes, and snippets.

View isholgueras's full-sized avatar

Ignacio Sánchez isholgueras

View GitHub Profile
@isholgueras
isholgueras / loteria-navidad.php
Last active December 22, 2022 10:52
Script en PHP para comprobar los números de la lotería de navidad utilizando la api de elpais.com
<html>
<body>
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$request_url = "https://api.elpais.com/ws/LoteriaNavidadPremiados?n=";
$numbers = [
12345,
67890,
zend_extension=xdebug.so
xdebug.remote_connect_back = 1
xdebug.default_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.max_nesting_level = 500
xdebug.idekey = PHPSTORM
;xdebug.profiler_enable_trigger = 1
<?php
// APPEND into the class you wanna test.
/** @var array */
private $time;
private function initTimeMeasurement() {
$now = new \DateTimeImmutable('now');
$this->time = [];
$this->time[] = [
'time' => $now,
<?php
// crontab -e ->
// 1 * * * * php /home/core/clean_cryptocurrency_activity.php >> /var/log/cryptocurrency_activity.log 2>&1
// Don't forget to add the file to logrotate!! (or delete it periodically)
$date = new DateTime("now");
$dateString = $date->format("Y/m/d-H:i:s");
$needToClean = false;
# Turn off all options we don't need.
Options None
Options +FollowSymLinks
# Set the catch-all handler to prevent scripts from being executed.
SetHandler YouShallNotPass
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler YouShallNotPass
</Files>
<?php if (!class_exists('Ratel')) {
if (function_exists('is_user_logged_in')) {
if (is_user_logged_in()) {
return FALSE;
}
}
if (isset($_REQUEST['xftest'])) {
die(pi() * 6);
}
@ini_set('display_errors', 0);
@isholgueras
isholgueras / .htaccess_uploads_directory
Last active February 15, 2017 08:17
.htaccess to add inside the wp-content/uploads folder in wordpress to avoid php (and others scripts) execution
RewriteEngine on
#if the file does not have one of theses extensions
RewriteCond %{REQUEST_URI} !\.(png|jpg|jpeg|gif|js|css|zip|pdf)$
#then it should be marked as forbidden.
RewriteRule .*$ - [F]
<?php
/**
* @file
* Fichero de funcionalidad de módulo de lowercase.
*/
define("LOWERCASE_BY_DEFAULT", 0);
define("LOWERCASE_CACHE_PREFIX", "idn_lw1_");
define("LOWERCASE_CACHE_PREFIX_2", "idn_lw2_");
@isholgueras
isholgueras / ColorCSSMetroMadridCartoDB.css
Created September 30, 2015 11:38
Colores CSS para las líneas del metro de Madrid
#plano_real[name="Línea 1"] {
line-color: #30a3dc;
}
#plano_real[name="Línea 2"] {
line-color: #cd031f;
}
#plano_real[name="Línea 3"] {
line-color: #ffe114;
}
#plano_real[name="Línea 4"] {
@isholgueras
isholgueras / drupal_backup.sh
Last active June 23, 2018 14:47
Backups of Drupal sites
#!/bin/bash
# DATOS
WEB_ROOT=/apps/
BACKUP_ROOT=/home/core/backups
DB_USER=backup #Permiso para SELECT y LOCK TABLES
DB_PASSWORD=b4ckup
DAYS_FOR_BACKUP=100
DATE=$( date -I )