This file contains 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
<?php | |
function extensionDe($nombre){ | |
$posicionPunto = strrpos($nombre, "."); | |
if($posicionPunto !== FALSE){ | |
return substr($nombre, $posicionPunto + 1); | |
}else return "Desconocida"; | |
} | |
//Probar | |
$archivos = [ |
This file contains 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
<?php | |
function apareceSoloUnaVez($cadena, $busqueda){ | |
return substr_count($cadena, $busqueda) === 1; | |
} | |
//Para probar | |
$arreglo = [ | |
"https://www.parzibyte.me" => "https", | |
"Hola, ¿Qué haces?" => "Qué", | |
":) hola :)" => ":)", | |
"Separado\ncon muchos\nsaltos de línea" => "\n", |
This file contains 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
class HolaMundo{ | |
public static void main(String[] argumentos){ | |
System.out.println("Hola mundo"); | |
} | |
} |
This file contains 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
<?php | |
$ruta_powershell = 'c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'; #Necesitamos el powershell | |
$opciones_para_ejecutar_comando = "-c";#Ejecutamos el powershell y necesitamos el "-c" para decirle que ejecutaremos un comando | |
$espacio = " "; #ayudante para concatenar | |
$comillas = '"'; #ayudante para concatenar | |
$comando = 'get-WmiObject -class Win32_printer |ft name'; #Comando de powershell para obtener lista de impresoras | |
$lista_de_impresoras = array(); #Aquí pondremos las impresoras | |
exec( | |
$ruta_powershell | |
. $espacio |
This file contains 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
<?php | |
$ruta_powershell = 'c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'; #Necesitamos el powershell | |
$opciones_para_ejecutar_comando = "-c";#Ejecutamos el powershell y necesitamos el "-c" para decirle que ejecutaremos un comando | |
$espacio = " "; #ayudante para concatenar | |
$comillas = '"'; #ayudante para concatenar | |
$comando = 'get-WmiObject -class Win32_printer |ft shared, name'; #Comando de powershell para obtener lista de impresoras | |
$delimitador = "True"; #Queremos solamente aquellas en donde la línea comienza con "True" | |
$lista_de_impresoras = array(); #Aquí pondremos las impresoras | |
exec( | |
$ruta_powershell |
This file contains 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 redondearAlMultiploMasCercano = (numero, multiplo) => | |
Math.ceil(numero / multiplo) * multiplo; | |
/* | |
Pruebas | |
*/ | |
console.log( | |
'redondearAlMultiploMasCercano(%d, %d) => %d', | |
30, | |
7, | |
redondearAlMultiploMasCercano(30, 7) |
This file contains 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 redondearAlMultiploMasCercanoAbajo = (numero, multiplo) => | |
Math.floor(numero / multiplo) * multiplo; | |
/* | |
Pruebas | |
*/ | |
console.log( | |
'redondearAlMultiploMasCercanoAbajo(%d, %d) => %d', | |
30, | |
7, | |
redondearAlMultiploMasCercanoAbajo(30, 7) |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://cdn.jsdelivr.net/npm/[email protected]/dist/pouchdb.min.js"></script> | |
</head> | |
<body> | |
<h1 id="resultado"></h1> | |
<script> | |
var elemento = document.querySelector("#resultado"); |
This file contains 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 wordpress_xmlrpc import Client | |
from wordpress_xmlrpc.methods.users import GetUserInfo | |
usuario = "tu_usuario" | |
contraseña = "tu_contraseña" | |
sitio = "tusitiodewordpress.com/xmlrpc.php" #Recuerda que debes llamar al archivo xmlrpc.php | |
cliente = Client(sitio, usuario, contraseña) | |
datos_usuario = cliente.call(GetUserInfo()) | |
print("Tu nombre de usuario es {}".format(datos_usuario)) |