Skip to content

Instantly share code, notes, and snippets.

View sojack's full-sized avatar

Jack sojack

View GitHub Profile
@sojack
sojack / phyllotactic.jsx
Last active January 30, 2022 15:37
Adobe illustrator - Phyllotaxis pattern generator
var mydoc = app.activeDocument;
var myLayer = mydoc.layers[0];
// var myLayer = mydoc.layers.add();
// myLayer.name = "myLayer";
var c = 4;
var size = 5;
correction=size/2;
function degrees_to_radians(degrees)
@sojack
sojack / gist:3b2b43adea45404e3ccee63dcad11642
Created August 20, 2018 14:40
measure file transfer speed
rsync -a --progress --stats --human-readable "/Users/.../Downloads/Files.zip" "/Volumes/..."
@sojack
sojack / blender-step.py
Created December 22, 2017 17:44
blender step-and-repeat
scn = bpy.context.scene
src_obj = bpy.context.active_object
for i in range (0,9):
new_obj = src_obj.copy()
new_obj.data = src_obj.data.copy()
new_obj.animation_data_clear()
currentLoc = 1.82884
offset = currentLoc +(2.0727 - 1.95077)*i
new_obj.location[0] = offset
@sojack
sojack / shiftpoints.jsx
Last active November 16, 2017 23:43
illustrator script - moves selected anchor points randomly (between max, min values)
var idoc = app.activeDocument;
var ipath = idoc.pathItems;
var offsetval = 300;
var roundv = 50;
for (var j = 0; j < ipath.length; j++){
var sel = ipath[j].selectedPathPoints;
for (var i = 0; i < sel.length; i++) {
var max = offsetval;
@sojack
sojack / iterate.py
Created November 14, 2017 22:27
blender iterate over selected items and perform an action
// code meant to be run on the python console
//blender iterate over selected items and perform an action
// in this case increase the resolution of a curve and extrude by a certain ammount
for nr, obj in enumerate(bpy.context.selected_objects):
obj.data.render_resolution_u = 24
obj.data.extrude = 0.006
@sojack
sojack / GitContribute-cheetsheet
Last active June 29, 2017 20:57
git contribution commands
fork project
clone locally
add upstream to original repo:
git remote add upstream <repo link>
git checkout master {make sure we are on the master branch}
git pull upstream master && git push origin master {sync local copy and forked repo with original}
git checkout -b <branch name> {create branch}
@sojack
sojack / makeRegmark.jsx
Created July 16, 2015 14:36
This Adobe Illustrator script creates regmarks for Zund cutter around dieline path which must be selected.
// This Adobe Illustrator script creates regmarks for Zund cutter around dieline path which must be selected.
// 2015-07-16 - on new illustrator version CC-2015 outercut layer was on top or regmark. Fixed by transposing the function calls at the end of the scritp.
// 2013-10-26 - now draws bullet beyond the bleed. Future improvement: bleed value dialogue box for instances of different values.
// 2013-03-18 - major rewrite, now draws bullets around multiple selected elements. Still to fix: outercut is perimeter- change to bleed.
// 2012-09-16 - minor fix to position of regmarks using position[x,y] instead top, left (which adds stroke weight when present)
// 2012-09-12 - minor fix to outer cut positioning
// 2012-09-03 - added outer cut and artboard resizing
// 2011-06-14 - basic functionality
var mydoc = app.activeDocument,
@sojack
sojack / duplicate.jsx
Created November 4, 2011 13:41
Illustrator Object Duplicator
if (app.selection[0] != null) {
var myDoc = app.activeDocument,
selectedArt = myDoc.selection[0],
dupNumber = 3, // set number of duplicates
horOffset = 10, // set horizontal offset
verOffset = 10, // set vertical offset
myDuplicate,
i = 0;
@sojack
sojack / setOverprintToFalse.js
Created September 24, 2011 15:47
Adobe Illustrator - set overprint to false
var myDocument = activeDocument,
numberOfChangedItems = 0; // counts the number of items with overprint stroke or fill
//loop through all path items and set overprint to false:
for (var i = 0; i < myDocument.pathItems.length; i++) {
var myPath = myDocument.pathItems[i];
if (myPath.strokeOverprint == true | myPath.fillOverprint == true){numberOfChangedItems++;};
if (myPath.strokeOverprint == true){myPath.strokeOverprint = false; myPath.selected=true;};
if (myPath.fillOverprint == true){myPath.fillOverprint = false; myPath.selected=true;};
}