Skip to content

Instantly share code, notes, and snippets.

Avatar

Jack James surrealroad

View GitHub Profile
@surrealroad
surrealroad / sg_create_versions_from_files.py
Created Jun 22, 2017
Shotgun API script to facilitate Version creation from folder of files
View sg_create_versions_from_files.py
#!/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 / sg_update_field_meta.py
Created Oct 30, 2019
Update Shotgun field descriptions from a CSV
View sg_update_field_meta.py
#!/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 / extract-reference-from-zip.sh
Last active Dec 12, 2016
Given a directory of zip files, loop through each file and extract a jpeg within the zip called {zipname}/{zipname}.jpg
View extract-reference-from-zip.sh
cd $SRC;
find . -name '*.zip' -exec sh -c 'unzip -j "{}" `basename {} .zip`/`basename {} .zip`.jpg -d "`dirname \"{}\"`"' ';'
@surrealroad
surrealroad / import-js.scpt
Created Dec 5, 2016
JXA Scriptlet to allow importing .js files in the same folder
View import-js.scpt
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 / gist:5146661
Last active Apr 6, 2016
Digital Ocean Discourse production install with LAMP (using Apache)
View gist:5146661
#create & deploy lamp droplet
#login via ssh as root
#initial setup (ref: http://library.linode.com/getting-started#sph_logging-in-for-the-first-time)
# update /etc/hosts (to "thalassophobia.surrealroad.com")
nano /etc/hosts
#
@surrealroad
surrealroad / Fetch Discourse Topics
Last active Mar 6, 2016
jQuery snippet to grab latest discourse forum posts and display them inside a container uses TBS classes
View Fetch Discourse Topics
// usage
var forumURL = 'http://forums.com';
$('#discourse-latest-container').getDiscourseTopics(forumURL, 'latest');
// fetch discourse items
(function($) {
jQuery.fn.getDiscourseTopics = function (url, page) {
// load forum topics
if($(this).exists()) {
$this = $(this);
@surrealroad
surrealroad / Parallels 9 Lamp
Last active Dec 30, 2015
How to create a LAMP using Parallels Desktop 9
View Parallels 9 Lamp
1. File > New…
2. Download Ubuntu Free
3. Set parallels user password
4. Install Parallels Tools / Restart
5. `sudo apt-get update`
6. `sudo apt-get install apache2`
7. `sudo apt-get install mysql-server`
8. `sudo apt-get install php5 libapache2-mod-php5`
9. Test browsing to http://localhost or http://parallels-ip-address
10. `sudo apt-get install openssh-server`
@surrealroad
surrealroad / find_fields_in_pages.rb
Last active Nov 23, 2015
Shotgun: find all pages a field is used on (Courtesy pboucher)
View find_fields_in_pages.rb
=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 / showquery.php
Created Aug 10, 2015
dump wordpress query
View showquery.php
<?php
echo "<pre>"; print_r($wp_query->query_vars); echo "</pre>";
?>
@surrealroad
surrealroad / Convert Avid Batch file newlines.sh
Last active Aug 29, 2015
Convert Avid batch newlines to Mac/Unix-friendly ones
View Convert Avid Batch file newlines.sh
# using sed
sed $'s/\\\r/\\\n/g' $FILE
# using tr
tr "\r" "\n" < "$FILE"