Skip to content

Instantly share code, notes, and snippets.

View sergiohidalgo's full-sized avatar

Sergio Hidalgo sergiohidalgo

View GitHub Profile
@sergiohidalgo
sergiohidalgo / permisos.md
Created April 12, 2017 19:29
Permisis directorios unix
# Poner todos los subfolder de un folder a 755:
find . -type d -exec chmod 755 {} \;

# Todos los archivos a 644:
find . -type f -exec chmod 644 {} \;

#Establecer solo los archivos que terminen con .php a 644:
find . -name \*\.php -exec chmod 644 {} \;
@sergiohidalgo
sergiohidalgo / .env.example
Last active May 8, 2017 22:03
WP Config base para usar archivo .env
DB_NAME=""
DB_USER=""
DB_PASSWORD=""
DB_HOST=""
DB_CHARSET="utf8"
DB_COLLATE=""
TABLE_PREFIX="wp_"
WP_SITEURL=""
WP_HOME=""
WP_DEBUG=""
@sergiohidalgo
sergiohidalgo / ftp-ubuntu.md
Last active April 6, 2018 03:45
Generar accesos FTP en Ubuntu con proftpd

Instalación

apt-get update
apt-get install proftpd

Ediar archivo de configuración

@sergiohidalgo
sergiohidalgo / add-oh-my-zsh.md
Last active July 28, 2017 16:14
Windows 10 + ubuntu - Customización

Agregar oh my zsh

Instalar dependencias para oh my zsh

sudo apt-get install curl git zsh

Descargar script de instalación

sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
(async () => {
await this.sleep(60000);
})();
@sergiohidalgo
sergiohidalgo / rsync.md
Last active March 15, 2020 22:48
Algunos comandos útiles que están en mi memoria pero generalmente me olvido de su sintaxis

Copy a file from remote server into a local folder:

rsync -v -e ssh [email protected]:/home/remoteuser/transfer/testfile.txt /home/localuser/

Synchronize folder from the remote server on the local server:

rsync -r -a -v -e ssh --delete [email protected]:/home/remoteuser/testfolder /home/localuser/testfolder
const exactLengthString = (input, length, filling) => {
let newString = '';
for (var i = 1; i <= length / filling.length; i++) newString += filling;
newString += input.toString()
return newString.substring(newString.length - length, newString.length + length)
}
console.log(exactLengthString('100', 4, '0')) // 0100