Skip to content

Instantly share code, notes, and snippets.

View surrealroad's full-sized avatar

Jack James surrealroad

View GitHub Profile
@surrealroad
surrealroad / sg_update_field_meta.py
Created October 30, 2019 17:57
Update Shotgun field descriptions from a CSV
#!/usr/bin/env python
# encoding: utf-8
"""
sg_import_assetlist.py
Import field descriptions from CSV file
Created by Jack James on 2019-10-30.
Copyright (c) 2019 Autodesk. All rights reserved.
Tasks
@surrealroad
surrealroad / sg_create_versions_from_files.py
Created June 22, 2017 00:06
Shotgun API script to facilitate Version creation from folder of files
#!/usr/bin/env python
# encoding: utf-8
"""
sg_create_versions_from_files.py
Create Versions in Shotgun from a folder of local files
• Create a new version with the name based on the filename
• Transcode the file and generate thumbnails and web-playable media
@surrealroad
surrealroad / extract-reference-from-zip.sh
Last active December 12, 2016 12:16
Given a directory of zip files, loop through each file and extract a jpeg within the zip called {zipname}/{zipname}.jpg
cd $SRC;
find . -name '*.zip' -exec sh -c 'unzip -j "{}" `basename {} .zip`/`basename {} .zip`.jpg -d "`dirname \"{}\"`"' ';'
@surrealroad
surrealroad / import-js.scpt
Created December 5, 2016 16:10
JXA Scriptlet to allow importing .js files in the same folder
ObjC.import('Foundation')
var app = Application.currentApplication()
app.includeStandardAdditions = true
var path = app.pathTo(this);
var workflowFolder = $.NSString.alloc.initWithUTF8String(path).stringByDeletingLastPathComponent.js + '/';
@surrealroad
surrealroad / showquery.php
Created August 10, 2015 13:59
dump wordpress query
<?php
echo "<pre>"; print_r($wp_query->query_vars); echo "</pre>";
?>
@surrealroad
surrealroad / find_fields_in_pages.rb
Last active November 23, 2015 16:39
Shotgun: find all pages a field is used on (Courtesy pboucher)
=begin
Find pages a field is used on
1. Edit the last line in the following script to reference the
appropriate field & entity
2. Paste the whole thing into the Ruby console for the site in
question
=end
@surrealroad
surrealroad / Convert Avid Batch file newlines.sh
Last active August 29, 2015 14:20
Convert Avid batch newlines to Mac/Unix-friendly ones
# using sed
sed $'s/\\\r/\\\n/g' $FILE
# using tr
tr "\r" "\n" < "$FILE"
@surrealroad
surrealroad / Plex_package_fix.sh
Last active August 29, 2015 14:15
Reformat Plex package for atom synology
# https://forums.plex.tv/index.php/topic/127360-this-package-does-not-contain-a-digital-signature/#entry763580
mkdir PlexMediaServer-0.9.11.7.803-87d0708-x86
cd PlexMediaServer-0.9.11.7.803-87d0708-x86
tar xvzf ../PlexMediaServer-0.9.11.7.803-87d0708-x86.spk
perl -pi -e 's/evansport/evansport avoton/g' INFO
tar -zcvf ../PlexMediaServer-0.9.11.7.803-87d0708-x86_atom.spk *
@surrealroad
surrealroad / Duplicate files & folders without content
Last active August 29, 2015 14:06
Duplicate files & folders without content
# http://stackoverflow.com/a/25847006/262455
# If there are only directories and regular files, you can do something like this:
cd "$src"
find . -type d -print0 | ( cd "$dst" ; xargs -0 mkdir -p )
find . -type f -print0 | ( cd "$dst" ; xargs -0 touch )
@surrealroad
surrealroad / FCP7XML_queries
Created June 23, 2014 15:32
XPath Queries for Final Cut Pro 7 XML files
// clips
"//clip"
// shot-take
"//clip[" & $clipIndex & "]/logginginfo/shottake"
// scene
"//clip[" & $clipIndex & "]/logginginfo/scene"
// default angle