Skip to content

Instantly share code, notes, and snippets.

View cesarcruzm's full-sized avatar

César Cruz cesarcruzm

  • Querétaro City
View GitHub Profile
@cesarcruzm
cesarcruzm / print_zpl.php
Created June 16, 2022 16:05 — forked from erighetto/print_zpl.php
Send raw ZPL to Zebra printer
<?php
error_reporting(E_ALL);
/* Get the port for the service. */
$port = "9100";
/* Get the IP address for the target host. */
$host = "172.17.144.89";
/* construct the label */
@cesarcruzm
cesarcruzm / php-ldap.php
Created October 11, 2021 13:05
Check LDAP Group Membership in PHP
<?php
/*
FROM https://jonlabelle.com/snippets/view/php/check-ldap-group-membership-in-php
*/
$user = 'bob';
$password = 'zhlob';
$host = 'myldap';
$domain = 'mydomain.ex';
@cesarcruzm
cesarcruzm / test-ldap-2.php
Created October 11, 2021 13:01 — forked from leftclickben/test-ldap-2.php
Open a connection to an LDAP server, query it for a given user, and check group membership for that user (test script)
#!/usr/bin/php
<?php
# Parse options
$opts = getopt('h:n:u:p:b:s:', array( 'help' ));
if (isset($opts['help']) && $opts['help']) {
echo <<<ENDHELP
Usage:
$argv[0] [-h HOSTNAME] [-n PORTNUM] [-u USERNAME] [-p PASSWORD] [-b BASEDN] [-s SEARCH]
@cesarcruzm
cesarcruzm / CustomersModel.php
Created March 24, 2021 18:05 — forked from scoumbourdis/CustomersModel.php
A full example of custom model for Grocery CRUD Enterprise
<?php
//CustomersModel.php
use GroceryCrud\Core\Model;
use GroceryCrud\Core\Model\ModelFieldType;
class CustomersModel extends Model {
protected $ci;
protected $db;
@cesarcruzm
cesarcruzm / readcfdi.php
Created December 29, 2019 00:57 — forked from goedecke/readcfdi.php
Extraer información de CFDI XML facil con simplexml
<?php
$xml = simplexml_load_file('test.xml');
$ns = $xml->getNamespaces(true);
$xml->registerXPathNamespace('c', $ns['cfdi']);
$xml->registerXPathNamespace('t', $ns['tfd']);
//EMPIEZO A LEER LA INFORMACION DEL CFDI E IMPRIMIRLA
foreach ($xml->xpath('//cfdi:Comprobante') as $cfdiComprobante){
echo $cfdiComprobante['version'];