Skip to content

Instantly share code, notes, and snippets.

View sleemanj's full-sized avatar

James Sleeman sleemanj

View GitHub Profile
@sleemanj
sleemanj / zoho-mail-undelete-restore-trash-bulk.js
Created December 1, 2023 06:21
Undelete (Restore From Trash) bulk Zoho Mail messages (more than 300 messages to restore).
/* Javascript snippet for when you accidentially move thousands of emails to the Zoho Mail Trash and want to restore them
* Zoho only lets you restore up to 300 at a time, you can't select all.
*
* This hacky javascript works around it. Open Zoho Mail and go into the Trash, open the console with CTRL-SHIFT-J
* paste this in, and then it will just sit there hitting the select-all checkbox and then the restore button for gogoCycleCount times
* to restore 50 emails at a time. Set the cycle count to however many emails you are restoring divided by 50.
*
* DO NOT TOUCH THE ZOHO MAIL WINDOW WHILE IT IS WORKING, no checks are made that it is in the Trash folder.
*
*/
@sleemanj
sleemanj / ESP32_HelloWorld.ino
Created September 7, 2022 22:53
A simple Arduino example of connecting an ESP32 to WIFI and requesting (HTTP GET) a page from the internet.
#include <WiFi.h>
#include <HTTPClient.h>
const String ssid = "PUT_YOUR_WIFI_NAME_HERE";
const String password = "PUT_YOUR_WIFI_PASS_HERE";
HTTPClient http;
String url = "http://sparks.gogo.co.nz/esp32/hello.html";
void setup() {
@sleemanj
sleemanj / lcsc-to-superbuy.js
Last active September 5, 2022 05:00
Load LCSC Cart Export Into Superbuy Forwarding Order
/** Kludgy script for fillling out a Superbuy Forwarding Order
* From LCSC Cart export
*
* Add stuff to your LCSC cart, export the cart (don't purchase yet)
* open the export in spreadsheet, add column 1 for type
* in column one record, for example "Capacitors", "Diodes",
* "Inductors"...
*
* Ensure that all parts have Customer # from BOM
* (set it to LCSC if none)
@sleemanj
sleemanj / pronto-keywood-codes-to-nec-device-function-decoder.php
Created January 3, 2022 00:14
Quick kludgy script to take a Pronto Hex format of code from the remotecentral.com database and blindly assuming it is NEC format with a single pulse lead-in and 32 bits, convert to NEC device and Function.
<?php
$Pronto = "0000 006d 0022 0002 0155 00ab 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0015 0015 0040 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 0040 0015 0040 0015 0040 0015 0040 0015 0040 0015 0040 0015 0015 0015 0040 0015 0015 0015 0015 0015 05ea 0155 0055 0015 0e3d";
$Pronto = preg_split('/ /', $Pronto);
// Remove header
array_shift($Pronto);
array_shift($Pronto);
array_shift($Pronto);
array_shift($Pronto);
#!/usr/bin/php
<?php
/* Yes this is terribly cobbled togethor, no there are no tests, it does what it needs to do,
which is to allow you to dump a bind format zonefile over the WHM API, and to update a
WHM domain from a bind zonefile, over the API, so you only need usual WHM access, resellers are fine. */
if(count($argv) < 2)
{
echo "\nBind To/From WHM API, Especially For Resellers\n";
@sleemanj
sleemanj / update_apex_alias.php
Last active January 18, 2021 00:19
Metaname (NZ Domain Registrar) API Script to allow something approaching ALIAS (aka ANAME) records to sort of set the Apex of a zone to be a CNAME.
<?php
/**
* Go through all DNS Zones in your Metaname account and for any zone that have
* a CNAME record called "_apex_", resolve the cname to an IP address and
* update thea actual Apex A record (what you get when you resolve the domain
* without a host) with that IP address.
*
* So you can do like for your example.com zone
*
@sleemanj
sleemanj / resistor-paralleler-for-jlcpcb-assembly-parts.js
Last active October 31, 2020 11:07
Adds a button to @yaqwsx JLC PCB Component Catalog to send the (filtered) resistors to a parallel-resistor-finder so you can find parallel resistor combinations based only on resistors JLC has available (especially useful for "Basic" ones).
// ==UserScript==
// @name Resistor Paralleler For JLC Parts
// @namespace https://gist.github.com/sleemanj/b5e75f18d7292ab43e37b96e2a7ef905
// @downloadURL https://gist.github.com/sleemanj/b5e75f18d7292ab43e37b96e2a7ef905/raw/resistor-paralleler-for-jlcpcb-assembly-parts.js
// @updateURL https://gist.github.com/sleemanj/b5e75f18d7292ab43e37b96e2a7ef905/raw/resistor-paralleler-for-jlcpcb-assembly-parts.js
// @version 0.3
// @description Send the resistors to the resistor paralleler. You must add Resistance as the last column in the table.
// @author James Sleeman
// @match https://yaqwsx.github.io/jlcparts/
// @grant none
@sleemanj
sleemanj / mt-recap-fix.js
Last active November 16, 2023 10:47
Fix for Mootools 1.3 with 1.2 compatibility layer to work with Recaptcha due to bind being incorrect with 1.2 compatibility enabled.
/* Quick Dirty Patch for Recaptcha with Mootools 1.2 Compatability Layer
*
* Make sure that all your mootools core/more source is loaded before this
* fix is loaded.
*
* @author James Sleeman <james@gogo.co.nz>
* @see https://github.com/google/recaptcha/issues/374
*
*/
@sleemanj
sleemanj / aliexpress-amortise-shipping-discount-tax.js
Last active January 9, 2020 04:39
Tampermonkey for Aliexpress order details page to amortise the shipping, discount and tax into the item price
// ==UserScript==
// @name Adjust order details to amortize shipping, discount and tax into item prices
// @namespace https://gist.githubusercontent.com/sleemanj/a56415ef7c9b8983888a7d7ec8686eb2
// @updateURL https://gist.githubusercontent.com/sleemanj/a56415ef7c9b8983888a7d7ec8686eb2/raw/aliexpress-amortise-shipping-discount-tax.js
// @downloadURL https://gist.githubusercontent.com/sleemanj/a56415ef7c9b8983888a7d7ec8686eb2/raw/aliexpress-amortise-shipping-discount-tax.js
// @version 1.0
// @description Adjust order details to amortize shipping, discount and tax into item prices
// @author James Sleeman
// @match *://trade.aliexpress.com/order_detail.htm*
// @grant GM_addStyle
@sleemanj
sleemanj / aliexpress-order-list-collapse.js
Last active April 28, 2021 02:07
Tampermonkey Script to Collapse your Aliexpress "My Orders" page and highlight orders which are Awaiting Delivery based on days remaining, light blue more than 28 days remain, orange more than 7 days, RED less than 7 days.
// ==UserScript==
// @name Collapse Order History on Aliexpress and highlight time remaining for orders awaiting delivery.
// @namespace https://gist.github.com/sleemanj/352f095f6f67564dae825f79204f1f01
// @updateURL https://gist.github.com/sleemanj/352f095f6f67564dae825f79204f1f01/raw/aliexpress-order-list-collapse.js
// @downloadURL https://gist.github.com/sleemanj/352f095f6f67564dae825f79204f1f01/raw/aliexpress-order-list-collapse.js
// @version 1.2
// @description Collapse the orders in My Orders to make the page more compact, highlight "Awaiting Delivery" ones.
// @author James Sleeman
// @match *://trade.aliexpress.com/orderList.htm*
// @grant GM_addStyle