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
<?php | |
/** | |
This is a simple proof of concept of a brute force algorithm for string matching with | |
given set of characters. | |
The way this works is that the algorithm counts from first to last possible combination of | |
given characters. Instead of counting(incrementing) in number base 10 we use | |
a new base which is derived from your set of possible characters (we count in symbols). | |
So if your characters list contains 27 characters the program actually counts in a 27 base | |
number system. |
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/pouchdb@6.4.1/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)) |
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 import posts | |
usuario = "" | |
contraseña = "" | |
sitio = "" | |
cliente = Client(sitio, usuario, contraseña) | |
entradas = cliente.call(posts.GetPosts()) | |
if len(entradas) > 0: | |
for entrada in entradas: | |
print(entrada) |
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 import posts | |
usuario = "" | |
contraseña = "" | |
sitio = "" | |
cliente = Client(sitio, usuario, contraseña) | |
entradas = cliente.call(posts.GetPosts()) | |
if len(entradas) > 0: | |
for entrada in entradas: | |
print(""" |
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
document.querySelector("#btnImprimir").addEventListener("click", function() { | |
var div = document.querySelector("#imprimible"); | |
imprimirElemento(div); | |
}); |