Skip to content

Instantly share code, notes, and snippets.

View mcantillana's full-sized avatar
馃彔
Working from home

Miguel Cantillana mcantillana

馃彔
Working from home
View GitHub Profile
@mcantillana
mcantillana / nginx-wordpress.conf
Created January 31, 2023 21:23 — forked from nfsarmento/nginx-wordpress.conf
Harden wordpress security nginx
############ WordPress ####################
# Disable logging for favicon and robots.txt
location = /favicon.ico {
try_files /favicon.ico @empty;
access_log off;
log_not_found off;
expires max;
}
@mcantillana
mcantillana / php-pools.md
Created June 1, 2022 01:21 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@mcantillana
mcantillana / s3ftp.install.sh
Last active March 24, 2020 02:49
Install S3 FTP with s3fs-fuse and amazon S3
#!/usr/bin/env bash
S3BUCKETNAME=<S3-BUCKET>
S3BUCKETREGION=<REGION S3>
FTPUSERNAME=<USER-FTP>
FTPPASSWORD=<PASS-FTP>
# =========================
sudo yum -y update
[
{ "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} },
{ "keys": ["ctrl+q"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+q"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["ctrl+w"], "command": "find_under_expand" },
{ "keys": ["ctrl+k", "ctrl+w"], "command": "find_under_expand_skip" },
// missing accented characters fix for ubuntu 14.10
@mcantillana
mcantillana / countdown
Created March 1, 2018 02:27
Countdown ticketera
<script>
/**
* Counts down to the given number of seconds
*
* @param element $element
* @param int seconds
* @returns void
*/
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
@mcantillana
mcantillana / Transantiago public endpoints.md
Created July 12, 2017 16:33 — forked from radutzan/Transantiago public endpoints.md
APIs REST p煤blicas con data del Transantiago. Respuestas en JSON.

Importante

Transantiago implement贸 estas APIs para uso interno, por lo que no hay ninguna garant铆a sobre su funcionalidad, mantenimiento o futura existencia. 脷salas bajo tu propio riesgo. (Probablemente no es aconsejable que las uses para nada cr铆tico.)

Paraderos alrededor de un punto

http://www.transantiago.cl/restservice/rest/getpuntoparada?lat=-33.6089714&lon=-70.5742975&bip=1

Estimaci贸n de parada

http://www.transantiago.cl/predictor/prediccion?codsimt=PA420&codser=504 (c贸digo de servicio es opcional, pero el par谩metro debe estar presente aunque est茅 vac铆o)

Lista de servicios

# Decorator definition:
from threading import Thread
def postpone(function):
def decorator(*args, **kwargs):
t = Thread(target = function, args=args, kwargs=kwargs)
t.daemon = True
t.start()
return decorator
# Example usage:
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@mcantillana
mcantillana / backup_mysql_database.sh
Created April 25, 2016 23:50
Full backup database MySQL
#!/bin/bash
################################################
#
# Backup all MySQL databases in separate files and compress those.
# Furthermore the script will create a folder with the current time stamp
# @author: Per Lasse Baasch (http://skycube.net)
# @Version: 2014-06-13
# NOTE: MySQL and gzip installed on the system
# and you will need write permissions in the directory where you executing this script
#