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 / pwd.php
Last active November 9, 2015 01:31
<?php
class PwdImg{
private $password;
private $chars = "abcdefghijklmnopqrstuvwxyz0123456789";
private $long;
public function __construct($pwd){
$this->long = strlen($this->chars);
@asfo
asfo / search.pipe.ts
Created January 31, 2018 17:10
Filtro de búsqueda para Angular 4/5
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'search'
})
export class SearchPipe implements PipeTransform {
public defaultDiacriticsRemovalMap: any = [
{ 'base': 'A', 'letters': '\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F' },
{ 'base': 'AA', 'letters': '\uA732' },
@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"
@asfo
asfo / Dockerfile
Created March 7, 2018 03:43
Dockerfile para Nginx
FROM ubuntu
MAINTAINER Asfo "asfoone@gmail.com"
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 / 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 / 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 / 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 / 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 / nginx.conf
Created March 7, 2018 03:55
Configuración de Nginx para Angular
worker_processes 4;
events
{
worker_connections 1024;
}
http
{
/**
* 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]
*