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
Supón que el disco duro es un gran arreglo. Se vería de la siguiente forma: | |
[ ][ ][ ][ ]...[ ] | |
Tradicionalmente el disco duro (arreglo) se particiona. Es decir, se segmenta el arreglo en sub-arreglos | |
todo con la intención de organizar el uso del disco, o destinar cada parte a una aplicación diferente. | |
Entonces, las particiones son elementos *físicos* de tu disco duro. Dentro de cada partición se usa un | |
"sistema de archivos". Este sistema de archivos permite al sistema operativo hacer un uso óptimo del | |
arreglo de bytes, es decir, guardar bloques de datos de forma eficiente, permitir que los bloques |
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
#!/bin/bash | |
trap 'rm -rf "$tempdir"' EXIT | |
tempdir=$(mktemp -d) | |
cd "$tempdir" || exit 1 | |
printf '%s\n' \ | |
'(return 2>/dev/null); echo $?' \ | |
> bash_return |
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
#!/usr/bin/awk -f | |
BEGIN { | |
state = "base"; | |
} | |
{ | |
length_of_line = length; | |
for (i = 1; i <= length_of_line + 1; i++) { |
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
#!/usr/bin/env python | |
import sys | |
credit = 200 | |
prices = [150, 24, 79, 50, 88, 345, 3] | |
n = len(prices) | |
k = 0 | |
sort = sorted(enumerate(prices), key=lambda x:x[1]) | |
r = n - 1 |
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
1) Linux no permite scripts suid; y si se pudiera, hacerlo sería | |
*demasiado* estúpido. ¿La razón? cualquier usuario del sistema ahora | |
puede reiniciar tu servicio. Si te comprometen el FTP, y obtienen un | |
shell como ftp, boom, adios. | |
2) El esquema con dos usuarios, www-data y root, con www-data en | |
sudoers. Claro que puedes utilizar las facilidades de «sudo» para | |
limitar qué comandos puede ejecutar www-data. De esta forma, puedes | |
tener una entrada como: |
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
#!/usr/bin/awk -f | |
function sqlite_escape(v) { | |
gsub(/'/, "''", v); | |
return v; | |
} | |
function process_line(_F, _NF) { | |
print "1:", _F[1]; | |
print "second to last:", _F[_NF - 1]; |
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
package main | |
import ( | |
"os" | |
"strconv" | |
) | |
func fibonacci(n int) uint64 { | |
if n > 0 { | |
return fibonacci(n - 1) * uint64(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
$ js wat.js | |
2 | |
0 | |
11 | |
0 | |
11 | |
0 | |
1 | |
1 | |
1 |
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
#!/bin/bash | |
shopt -s extglob | |
function isValidIdentifier { | |
typeset identifier=$1 identifierPattern='+([[:alpha:]_])+([[:alnum:]_])' |
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
#!/usr/bin/env python | |
from zipfile import ZipFile | |
from os import walk | |
from os.path import isfile, isdir, join | |
class Zipper(object): | |
_class = ZipFile | |
def __init__(self, zip_file, recurse=False): | |
self._zip = self._class(zip_file, 'w') |
OlderNewer