Skip to content

Instantly share code, notes, and snippets.

View sergiohidalgo's full-sized avatar

Sergio Hidalgo sergiohidalgo

View GitHub Profile
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
@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
sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
(async () => {
await this.sleep(60000);
})();
@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

@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 / .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 / 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 {} \;
http://www.facebook.com/dialog/feed?  
app_id=646147048890986&  
link=http://lg-navidad.dmeat.cl/&
picture=http://fbrell.com/f8.jpg&  
name=Facebook%20Dialogsssss4444444&  
caption=Reference%20Documentation& 
description=Dialogs%20provide%20a%20simple,%20consistent%20interface%20for%20applications%20to%20interact%20with%20users.&
message=Facebook%20Dialogs%20are%20so%20easy!&
@sergiohidalgo
sergiohidalgo / alias.sh
Last active July 21, 2017 21:19
Alias para terminal
DOCKER_BIN='/mnt/c/Program Files/Docker/Docker/resources/bin'
for f in "$DOCKER_BIN"/*; do
alias "$(basename "$f" | sed 's/.exe$//')"'="'"$f"'"'
done
alias dev='~/Developer'
alias htdocs='/Applications/MAMP/htdocs'
alias ls -all='ls -GFlash'
alias valet-run='valet start && brew services start mysql'
alias valet-die='valet stop && brew services stop mysql'