El objetivo de este snippets es explicar como mantener actualizado tu sistema evitando que queden versiones innecesarias que no uses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const truncateString = (str, num) => | |
str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str; | |
truncateString('boomerang', 7); // 'boom...' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Functions | |
# | |
# System functions | |
# | |
find_kill_process() { | |
# This function shows the process list and search on it | |
# Requires fzf available | |
pid=$(ps -ef | sed 1d | eval "fzf $FZF_DEFAULT_OPTS -m --header='[kill:process]'" | awk '{print $2}') | |
if [ ! -z "$pid" ] | |
then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ValidateSpanishID. Returns the type of document and checks its validity. | |
* | |
* Usage: | |
* ValidateSpanishID( str ); | |
* | |
* > ValidateSpanishID( '12345678Z' ); | |
* // { type: 'dni', valid: true } | |
* | |
* > ValidateSpanishID( 'B83375575' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.tree-element { | |
margin: 0; | |
position: relative; | |
} | |
div.tree-element:before { | |
content: ''; | |
position: absolute; | |
top: 24px; | |
left: 1px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy | |
def min_n(lst, n=1): | |
numbers = deepcopy(lst) | |
numbers.sort() | |
return numbers[:n] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function arrify(val) { | |
return val == null ? [] : Array.isArray(val) ? val : [val]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addParams(url = "", params = {}) { | |
// Inicializamos la URL | |
let myUrl = new URL(url); | |
// Obtenemos todas las keys de los parametros que nos vienen del objeto, en el ejemplo "foo" y "eggs" | |
// Usamos el foreach para recorrer cada key y extraer su valor con params[key] | |
// Con searchParams.append agregamos los parametro que queremos | |
Object.keys(params).forEach(key => openStreetMapReverseGeocodeUrl.searchParams.append(key, params[key])); | |
// Retornamos la url | |
return myUrl; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nmap -p 22 192.164.1.0/8 | |
# -p: el puerto a buscar, en este caso ssh, el 22 | |
# rango de ip a buscar: el /8 son toda las ip todas las ips del cero final |