Skip to content

Instantly share code, notes, and snippets.

View ctala's full-sized avatar
🏠
Working from home

Cristian Tala S. ctala

🏠
Working from home
View GitHub Profile
@ctala
ctala / functions.php
Created October 4, 2023 08:35
Este fragmento de código PHP para WordPress automatiza el llenado del Atributo ALT en las imágenes destacadas de tus posts. Diseñado para mejorar tanto la accesibilidad como el SEO, este script extrae el título del post y lo asigna como el Atributo ALT de la imagen destacada cuando este campo está vacío.
<?
/**
MIT License
Copyright (c) 2023 Cristian Andrés Tala Sánchez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# docker-compose.yml
#
# Author: Cristian Tala Sánchez
# License: MIT
# Website: https://cristiantala.cl
#
# Licencia MIT:
#
# Derechos de autor (c) 2023 Cristian Tala Sánchez
#
@ctala
ctala / robots.txt
Last active March 13, 2023 15:34
Wordpress SEO optimized
#Este robots.txt está optimizado para el SEO del sitio wordpress.
User-agent: *
#Bloqueos de Wordpress
Disallow: /wp-admin/
Disallow: /cgi-bin
Disallow: /wp-content/plugins/
Disallow: /wp-content/themes/
Disallow: /wp-includes/
Disallow: /wp-login.php #block access to admin section
@ctala
ctala / resulted_policy.json
Last active September 23, 2020 22:51
AWS Sample Resource Policy VPC Whitelist and Resulted Policy from Serverless
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": "arn:aws:execute-api:us-west-2:607613765343:80nyvq2u70/*/*/*",
"Condition": {
"StringNotEquals": {
@ctala
ctala / MyWebApplication.php
Created September 18, 2020 21:05
Yii2 Modfied Web Application to Redirect to Https under a Load Balancer provided by AWS.
<?php
namespace common\components;
use Yii;
use yii\web\Application;
/**
* Reescribo para siempre usar HTTPS si es que la url no es segura
* Class MyWebApplication
@ctala
ctala / postConfirm.yml
Created March 29, 2020 13:33
Example of YAML file for Serverless framework to create SNS topics and export the name and the arn.
Resources:
SnsPostConfirm:
Type: "AWS::SNS::Topic"
Properties:
TopicName: ${self:custom.snsTopicPostConfirm}
DisplayName: Post Confirm User Cognito
Outputs:
#Name of the topic to use it from other resources
SnsPostConfirmNAME:
@ctala
ctala / .travis.yml
Created March 6, 2020 13:27
TravisCI with GitHUB Package Repository (Only Pre Install and Install ) that generates .npmrc with github token
language: node_js
node_js:
- 10
cache:
directories:
- node_modules
before_install:
- echo "INSTALL GLOBAL DEPENDENCIES"
@ctala
ctala / .htaccess
Last active December 14, 2019 20:58
Example of Security Headers for a PHP application using .htaccess for Apache2
# Extra Security Headers
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
Header always append X-Frame-Options SAMEORIGIN
Header set X-Content-Type-Options nosniff
</IfModule>
# Solving Cookies created without HTTPOnly and Secure flag
php_value session.cookie_httponly 1
php_value session.cookie_secure 1
@ctala
ctala / disable_tcp_timestamp.config
Last active December 14, 2019 18:46
he following file disables the tcp_timestamps vulnerability on a Linux 1 AWS AMI using .ebextentions for an Elastic Beanstalk Application on deployment
###################################################################################################
#### Copyright 2019 cristiantala.cl. All Rights Reserved.
####
#### Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
#### except in compliance with the License. A copy of the License is located at
####
#### http://aws.amazon.com/apache2.0/
####
#### or in the "license" file accompanying this file. This file is distributed on an "AS IS"
#### BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@ctala
ctala / handler.js
Created December 5, 2019 20:03
Probando Serverless Lambda y Proxy RDS Integration
'use strict';
const mysql = require('mysql2');
const connectionParams = {
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME,
port: process.env.DB_PORT,
};