Skip to content

Instantly share code, notes, and snippets.

View ellisgl's full-sized avatar
💭
Coding!

Ellis ellisgl

💭
Coding!
View GitHub Profile
@ellisgl
ellisgl / debug.txt
Created March 29, 2024 20:50
CubeCell - RadioLib - POCSAG Debug
Copyright @2019-2020 Heltec Automation.All rights reserved.
[CubeCell] Initializing ...
RLB_DBG: RadioLib Debug Info
RLB_DBG: Version: 6.5.0.0
RLB_DBG: Platform: CubeCell
RLB_DBG: Compiled: Mar 29 2024 15:36:13
RLB_SPI: CMDW 80
RLB_SPI: SI 0
@ellisgl
ellisgl / server.php
Created May 7, 2023 17:13
Simple SMTP server in PHP - Saves attachments - was used to get stuff from a network scanner.
<?php
include_once('vendor/autoload.php');
use ZBateson\MailMimeParser\Header\AddressHeader;
use ZBateson\MailMimeParser\MailMimeParser;
use ZBateson\MailMimeParser\Message\IMimePart;
const SMTP_RESP_220 = '220 localhost ESMTP PHP8.1 Ready';
const SMTP_RESP_221 = '221 localhost ESMTP PHP8.1 Service closing transmission channel';
@ellisgl
ellisgl / PHPDocReturnTypes.php
Last active May 7, 2023 15:38
Use PHPStan\PhpDocParser to parse the return types listed in a PHPDoc comment.
<?php
include 'vendor/autoload.php';
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode;
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
@ellisgl
ellisgl / Serial Protocol RFC.md
Last active May 14, 2023 03:14
[DRAFT] Request For Comments: Universal Serial Device Communication Protocol (USDCP)

# RFC: Universal Serial Device Communication Protocol (USDCP)

## Introduction: This document describes the Universal Serial Device Communication Protocol (USDCP), a standard communication protocol for serial devices. The purpose of this protocol is to provide a standardized format for requesting and receiving data from serial devices. The protocol defines the structure of request and response packets, and also provides specific definitions for certain requests and their responses.

USDCP supports three baud rates: 115,200, 9600, and 1200, with 115,200 being the default.

## Packet/Frame Structures: USDCP request and response packets consist of the following fields:

@ellisgl
ellisgl / 01-Original.sql
Last active November 6, 2021 15:55
MySQL performance optimization (OR to UNION)
# tbla idx1 b,e,f
SELECT a.*
FROM tblA a
INNER JOIN tblB b ON a.id = b.aId
WHERE a.b IN (1,2,3)
AND (a.c IN (3,4,5) OR a.d IS NOT NULL)
AND a.e = 0
AND a.f = 0
ORDER BY a.g ASC
/*
SQLyog Community v8.3
MySQL - 5.1.36-community-log : Database - x5
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
@ellisgl
ellisgl / colormd.js
Created October 6, 2021 01:40
16 Color support MD?
// Support Color Markdown
data = data.replace(/\{color fg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBlue|PinkGray|LightGray)\}([^{]+)\{\/color\}/img, '<span style="color:$1;">$2</span>');
data = data.replace(/\{color bg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBlue|PinkGray|LightGray)\}([^{]+)\{\/color\}/img, '<span style="background-color:$1;">$2</span>');
data = data.replace(/\{color fg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBlue|PinkGray|LightGray) bg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBlue|PinkGray|LightGray)\}([^{]+)\{\/color\}/img, '<span style="color:$1; background-color:$2;">$3</span>');
data = data.replace(/\{color bg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBlue|PinkGray|LightGray) fg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBl
@ellisgl
ellisgl / PaginationTest.php
Last active August 28, 2021 21:15
Pagination of a MySQL query sorted by non-unique values benchmark.
<?php
// Pagination of a MySQL query ordered by non-unique values benchmark:
// The normal way with limit/offset.
// Grabbing all the id's and then doing the queries w/ groups of ids.
// This uses the MySQL employee example DB: https://dev.mysql.com/doc/employee/en/
function get_time() {
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
@ellisgl
ellisgl / keyCap.schema.md
Last active February 27, 2020 00:36
Advanced Keyboard Layout Editor Object Schemas
@ellisgl
ellisgl / GLT-KB-E-1-R.kbd.json
Last active February 16, 2020 05:04
GLT-KB-E-1-R
[
{
"backcolor": "#666666",
"name": "GLT-KB-E-1-R",
"author": "Geeklab Technologies",
"switchMount": "cherry",
"switchBrand": "cherry",
"pcb": true,
"plate": false
},