Skip to content

Instantly share code, notes, and snippets.

View sleemanj's full-sized avatar

James Sleeman sleemanj

View GitHub Profile
@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 / 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-qty-search-fix.js
Last active February 21, 2019 11:18
Return the Quantity Search on Aliexpress
// ==UserScript==
// @name Return the Quantity Search, Show Per Piece Pricing
// @namespace https://gist.github.com/sleemanj/95035bf2c0141ac72420
// @updateURL https://gist.github.com/sleemanj/95035bf2c0141ac72420/raw/aliexpress-qty-search-fix.js
// @downloadURL https://gist.github.com/sleemanj/95035bf2c0141ac72420/raw/aliexpress-qty-search-fix.js
// @version 1.1
// @description Put the quantity search fields back into the search interface on Aliexpress when they are not present and add a per-piece pricing when possible on the listing pages.
// @author James Sleeman
// @match *://*.aliexpress.com/*
// @exclude *://trade.aliexpress.com/orderList.htm*
@sleemanj
sleemanj / dirtyimager.sh
Last active December 18, 2017 04:24
Create image from gerbers with gerbv
#!/bin/bash
HOLES="$1"
SILK="$2"
MASK="$3"
COPPER="$4"
# We need to "invert" the mask, this is dirty but seems to work, further testing required on larger sample set :)
echo "%IPNEG*%" > /tmp/newMask.gbr
cat "$MASK" | sed -r 's/%IP(POS|NEG)\*%//' >>/tmp/newMask.gbr
@sleemanj
sleemanj / asc-xml.php
Created April 17, 2017 00:07
Convert DipTrace .asc library Export Format into an XML structure, and back again.
#!/usr/bin/php
<?php
// Convert .asc into a .xml representation, or the reverse
//
// The attributes of each "asc" element '(Blah 123 "abc" )' are just dumped
// into _PARAMS="" attribute of the node '<Blah _PARAMS="123 &quot;abc&quot;" />'
//
// Take note that in the XML, _UNCLOSED="1" means that this tag
// when converted to asc must have the closing ")" on a separate line
// even if it is empty, not all do.
@sleemanj
sleemanj / pd.py
Created May 29, 2016 09:26
Sigrok Timing Decoder with Frequency and Averaging
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2014 Torsten Duwe <duwe@suse.de>
## Copyright (C) 2014 Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
@sleemanj
sleemanj / eevblog-no-annoyance.user.js
Last active October 30, 2015 08:17
Remove Annoying EEVBlog Ad In Last Post
// ==UserScript==
// @name EEVBlog Remove The Annoyance
// @namespace https://gist.github.com/sleemanj/84e15fda23f79a7852b6
// @updateURL https://gist.github.com/sleemanj/84e15fda23f79a7852b6/raw/eevblog-no-annoyance.user.js
// @downloadURL https://gist.github.com/sleemanj/84e15fda23f79a7852b6/raw/eevblog-no-annoyance.user.js
// @version 0.5
// @description Remove tha silly ad-containing post
// @match http://www.eevblog.com/forum/*
// @copyright 2015+, James Sleeman
// ==/UserScript==