Skip to content

Instantly share code, notes, and snippets.

View isonno's full-sized avatar

J. Peterson isonno

View GitHub Profile
@isonno
isonno / ZeptoShrink.jsx
Created January 23, 2022 20:54
Photoshop script to shrink Zeptobars images to fit on a Nixplay picture frame
// Zeptobars has been producing fantastic photos of microelectronics
// for several years, see https://zeptobars.com I recently received
// a Nixplay digital picture frame, and wanted to upload the photos to
// the frame.
//
// The Nixplay picture frame has an image file size limit of 20MB. Some of
// the "HD" images from Zeptobars are larger than this, so this script finds
// all the photos in the collection over the limit and downsamples them
// to 2K resolution (more than enough for the Nixplay frame).
@isonno
isonno / CheckAzon.py
Last active January 17, 2022 21:40
Check Amazon email to make sure returns are refunded.
#
# Many Amazon packages were lost when they started robbing the mail
# in LA. See https://twitter.com/johnschreiber/status/1481770722271760384
#
# So, I wanted to check to see if stuff we'd sent back to Amazon actually
# arrived for a refund. Amazon typically sends two emails, one for
# initiating the return, and another for the actual refund.
#
# This plows through all the Amazon email, and collects the return/refund
# messages by order number, and produces a report, so you can quickly check
@isonno
isonno / polygons.html
Last active June 15, 2016 02:00
Display polygon data for debugging.
<div style="overflow: auto;">
<textarea id="data" rows="6" cols="80">
[[[0,132.47098],[0,0],[585.1935,0],[586.91061,7.60481],[1.7171,140.0758],[0,132.47098]],[[585.1935,0],[674.50749,0],[675.50749,390.129],[667.90362,391.85029],[577.58963,1.72129],[585.1935,0]],[[676.50749,390.129],[674.50749,523.59999],[88.31399,525.59999],[86.53721,518.00889],[674.73071,382.5379],[676.50749,390.129]],[[88.31399,526.59999],[0,523.59999],[0,132.47098],[7.59518,130.71176],[95.90917,524.84077],[88.31399,526.59999]]]
</textarea>
</div>
<div id="content" style="overflow: auto;">
<canvas id="drawing">
</canvas>
</div>
<button id="reload">
@isonno
isonno / WinUpdateList.py
Last active May 11, 2016 08:39
Make a web page for learning about all those Windows updates!
#
# Pop open KB windows for MS updates.
# Go to the Windows Update panel. Then select all / Copy the text from
# the "Select Updates" pane. Paste it into a "Updates.txt" file.
# Then run this. It'll make a web page where all the update titles
# link to the web page with the actual description of the udpdate.
#
import os, webbrowser, re
@isonno
isonno / moveMaskFrom.js
Created December 22, 2015 23:05
Copy a vector mask from a shape to another (non-shape) layer.
//
// Copy the vector mask from a shape to another layer.
// This takes layer names, modify as indicated below to take
// layer ID's instead.
// The shape is not deleted or modified.
function createMaskFromShape(srcShapeName, layerToClip)
{
srcLayerRef = {"_ref":"layer","_name":srcShapeName}; // Replace "_name" with "_id"
dstLayerRef = {"_ref":"layer","_name":layerToClip}; // to use layer ID's instead.
@isonno
isonno / ShapeToVectorMask.js
Last active December 2, 2015 23:00
Sample Spaces code to convert a shape layer to a vector mask.
// Take a shape specified by clipShapeID, and use it to
// create a vectorMask for layer clippedLayerID.
// Shape layer is deleted.
function createMaskFromShape(clipShapeID, clippedLayerID)
{
var clipShapeDesc = {"null":{"_ref":[{"_ref":"layer","_id":clipShapeID}]}};
var clippedLayerDesc = {"null":{"_ref":[{"_ref":"layer","_id":clippedLayerID}]}};
var vecMaskRef = {"_ref":"path","_enum":"path","_value":"vectorMask"};
@isonno
isonno / layerBounds.js
Last active November 3, 2015 23:16
Demo code for retrieving layer bounds un-clipped by the vectorMask
//
// Sample code to retrieve the bounds of the layer's vector mask, and
// also get the unclipped bounds of the mask by temporarily disabling the
// vector mask.
//
// Get attribute from the active layer.
// Records the requested result in "state".
function promiseLayerGet(resultKey, state)
{
@isonno
isonno / GeneratorToggle.js
Last active August 29, 2015 14:27
Sample code to enable/disable from DesignSpace JavaScript
//
// Sample code to enable/disable Generator from DesignSpace JavaScript
// J. Peterson aug-'15
//
// Reference to the generator keys
function appRef(key)
{ // either generatorStatus or pluginPicker
return {"_ref":[{"_ref":"property","_property":key},
{"_ref":"application","_enum":"ordinal",
@isonno
isonno / VectorBoundsMask2.js
Last active November 3, 2015 23:09
VectorBoundsMask using BatchPlay
//
// Code sample for creating a rectangular vector mask
// around the target paint layer. J. Peterson
//
function getLayerBounds()
{
var p = new Promise(function(resolve, reject)
{
_spaces.ps.descriptor.get({_ref:[{"_ref":"property","_property":"bounds"},
@isonno
isonno / VectorBoundsMask.js
Last active November 3, 2015 23:20
Sample DS code for creating a vector mask
//
// Code sample for creating a rectangular vector mask
// around the target paint layer. J. Peterson
//
function getLayerBounds()
{
var p = new Promise(function(resolve, reject)
{
_spaces.ps.descriptor.get({_ref:[{"_ref":"property","_property":"bounds"},