Skip to content

Instantly share code, notes, and snippets.

@planetahuevo
planetahuevo / upload.php
Last active October 27, 2024 17:50 — forked from fowkswe/upload.php
Replacement for sendy's upload.php that sends files to S3 rather than the server.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include('../functions.php');
include('../login/auth.php');
require_once('../helpers/S3.php');
if (!isset($_FILES['upload'])) {
die('No file uploaded');
@planetahuevo
planetahuevo / upload.php
Created October 27, 2024 17:49 — forked from lexnjugz/upload.php
Replacement for sendy's upload.php that sends files to S3 rather than the server.
<?php
//
// this replaces includes/create/upload.php - besure to save your old upload.php!
// you must put the S3.php file in includes/helpers/S3.php
// you can get it here:
// https://github.com/tpyo/amazon-s3-php-class
//
// This is an improvement on this gist:
// https://gist.github.com/Wysie/03934b6a79a715772abd
//
@planetahuevo
planetahuevo / gist:e3f2e69b61408e14f4de8fe1de9e43ca
Last active October 27, 2024 17:35 — forked from Wysie/gist:03934b6a79a715772abd
Upload to Amazon S3 Instead of Server for Sendy Email Image Uploads
//Using S3.php from https://github.com/tpyo/amazon-s3-php-class. Place it in includes/helpers
//Replaces Sendy's includes/create/upload.php
// for sendy 2.1.0.2
//Add in includes/config.php =>
// define('AWS_ACCESS_KEY', 'xxxx');
// define('AWS_SECRET_KEY', 'xxxx');
// define('S3_ENDPOINT', 's3.amazonaws.com');
// define('S3_BUCKET_NAME', 'xxxx');
<?php
@planetahuevo
planetahuevo / prueba-cert.php
Created July 24, 2024 14:41 — forked from joseconti/prueba-cert.php
Prueba nuevo certificado Redsys
<?php
$url_conexion = 'https://sis-t.redsys.es:25443';
$conexion = curl_init();
curl_setopt( $conexion, CURLOPT_URL, $url_conexion );
curl_setopt( $conexion, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt( $conexion, CURLOPT_TIMEOUT, 60 );
curl_setopt( $conexion, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $conexion, CURLOPT_POST, true );
// CURLOPT_SSL_VERIFYPEER indica a cURL que valide la cadena de certificados del servidor con los certificados raíz del almacén local
@planetahuevo
planetahuevo / cloudflare-purge-cache-service-worker.js
Last active October 29, 2023 13:24 — forked from vdbelt/cloudflare-purge-cache-service-worker.js
A CloudFlare service worker that proxies purge cache requests. Example: https://example.com/__purge_cache?zone=XX
addEventListener('fetch', event => {
event.respondWith(purgeCache(event.request))
})
async function purgeCache(request) {
const url = new URL(request.url)
@planetahuevo
planetahuevo / 0-README.md
Created September 11, 2023 19:14 — forked from Overbryd/0-README.md
Cloudflare Fragment Caching

Cloudflare fragment rendering/caching

This worker script will evaluate your origin response, and replace html comments marked as fragment:key with a respective prefetch defined in a X-Fragments response header.

Usage

Your origin must include the X-Fragments header, specifying the a comma separated list of prefetch requests to make for that response.

< HTTP/1.1 200 OK
body {
background-image: url(https://live.staticflickr.com/65535/51705970602_9f5ec7b9a8_k.jpg);
background-size: 100% 100%;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
transition: background .2s;
color:#fff;
}
@planetahuevo
planetahuevo / a_faster_load_textdomain.php
Created June 25, 2021 23:57 — forked from soderlind/a_faster_load_textdomain.php
A faster load_textdomain for WordPress
<?php
/*
Plugin Name: A faster load_textdomain
Version: 0.0.1
Description: While we're wating for https://core.trac.wordpress.org/ticket/32052.
Author: Per Soderlind
Author URI: https://soderlind.no
Plugin URI: https://gist.github.com/soderlind/610a9b24dbf95a678c3e
License: GPL
@planetahuevo
planetahuevo / Stackedit.md
Created April 19, 2021 23:50 — forked from nztim/Stackedit.md
Install StackEdit on Ubuntu 14.04

###Install Node and Bower

  • Set up the NodeSource repo and install Node
  • curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
  • sudo apt-get install nodejs
  • Install bower: sudo npm install -g bower

Install StackEdit

  • Clone the repo: git clone https://github.com/benweet/stackedit
  • To use a domain other than 'localhost', edit /public/res/constants.js:
  • constants.BASE_URL = "http://stackedit.dev:3000/";
@planetahuevo
planetahuevo / sec-scan-v6.sh
Created January 30, 2021 19:32 — forked from CapWebSolutions/sec-scan-root.sh
Latest iteration of security scanning script for MainWP instance.
#
# This script is executed from a terminal prompt at the root of your MainWP WordPress website.
# It uses the same services as WP CLI, so if WP CLI runs, this should also.
#
# Execute MainWP CLI command to generate a list of all configured sites in MainWP
# Pipe output through filter to remove columns 3 and 4 of output. These columns hold the 2 digit site number. Adjust if more than 99 sites.
# Pipe that output to get rid of the comment lines in the site listing.
# Pipe that output through the SED editor inserting the security scan command at the beginning of the line
# Send everything to a shell script to be executed.
rm -f sec-scan-auto.sh