Skip to content

Instantly share code, notes, and snippets.

View asfo's full-sized avatar
Verified profile

Asfo Zavala asfo

Verified profile
View GitHub Profile
@asfo
asfo / functions.php
Created September 6, 2023 01:32
Send WP Media to Another Server Using FTP
<?php
// Not working at the moment as this cause an issue with Elementor
function upload_to_ftp( $args ) {
$upload_dir = wp_upload_dir();
$upload_url = get_option('upload_url_path');
$upload_yrm = get_option('uploads_use_yearmonth_folders');
$settings = array(
'host' => '', // * the ftp-server hostname
'port' => 21, // * the ftp-server port (of type int)
/**
* This code is stored to save my exam to Wizeline that I took for fun, sorry Wizeline if someone finds this...
* Technically it could be pretty simple, a "join" of the array, then parse to int, then sum 1, then split again the numbers
* and parse each to integer, and that's it, but the rules are:
* the numbers are going to be between 1 and 9, no trailing zero...like: [1,2,3,4,5,6,7,8,9] in the array but...
* the array size can be up to 10,000 (10e4 -> 10 * 10 * 10 * 10) so we can have a digits.length of 10,000 which means, we can have
* a loooooooooooooot of numbers that are going to "sum" a really big number, if we use parseInt then, after the "join" we are going
* to end with a "32131e1221" which is something that we don't want to...
* and the "+1" rule so for example: [9,9,9] is converted to 999 + 1 = 1000 and we need to return [1,0,0,0]
*
@asfo
asfo / fake_players.md
Last active April 13, 2023 01:57
Fake players for AzerothCore

How to use it:

Warning:It works only for AzerothCore and doesn't works on the last commit since it have some issues and the worldserver crashes, so that's why I'm not updating it to the latest version of AC, once that bug got fixed, I will update it.

  • Go to the root directory where you clone the repo, create a "patches" directory.
  • Create a file called fake_players.patch
  • Add the code above
  • Go back to the root directory
  • Run the command:
@asfo
asfo / index.js
Created August 19, 2019 21:15
index.js para el tutorial de Medium acerca de la seguridad de APIs con JWT
const express = require('express'),
bodyParser = require('body-parser'),
jwt = require('jsonwebtoken'),
app = express();
const config = {
llave : "miclaveultrasecreta123*"
};
// 1
@asfo
asfo / git.sh
Created June 6, 2018 15:38
Git.sh para subir archivos a Git de forma automática.
#!/bin/sh
#
# Git.sh
#
# Uso: ./git.sh
#
# Original: http://sekika.github.io/2016/06/06/github-many-files/
#
# Sin acentos*
@asfo
asfo / blockips.conf
Created March 7, 2018 04:09
Bloqueador de IPs para Nginx
deny 5.228.100.253;
deny 176.77.9.144;
deny 94.180.134.52;
deny 95.24.146.125;
@asfo
asfo / nginx.conf
Created March 7, 2018 03:55
Configuración de Nginx para Angular
worker_processes 4;
events
{
worker_connections 1024;
}
http
{
@asfo
asfo / conf
Created March 7, 2018 03:50
Conf OpenSSL Nginx
if [ $OPENSSL != NONE ]; then
case "$CC" in
cl | bcc32)
have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have
CFLAGS="$CFLAGS -DNO_SYS_TYPES_H"
@asfo
asfo / Dockerfile
Created March 7, 2018 03:43
Dockerfile para Nginx
FROM ubuntu
MAINTAINER Asfo "[email protected]"
ENV NGINX_VERSION 1.13.4
RUN apt-get update && apt-get install -y ca-certificates build-essential wget libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev
RUN wget http://www.openssl.org/source/openssl-1.0.2d.tar.gz \
&& tar -xvzf openssl-1.0.2d.tar.gz \
@asfo
asfo / docker-compose.yml
Created March 7, 2018 03:37
Docker Compose para Angular + Nginx
app:
build: ./nginx
restart: always
volumes:
- ./angular:/var/www/html/angular
ports:
- "80:80"
- "443:443"