Skip to content

Instantly share code, notes, and snippets.

View pboucher's full-sized avatar

Patrick Boucher pboucher

View GitHub Profile
@pboucher
pboucher / find_custom_home_pages.rb
Last active July 18, 2017 22:18
Find users' custom home pages on hosted sites for data analysis.
site = ENV["RAILS_ENV"]
HumanUser.find(:all, :conditions=>{:retirement_date=>nil}).each do |u|
next if u.custom_home_page.nil? || ['inbox', 'my_tasks', 'new_user_welcome'].include?(u.custom_home_page.page_type)
data = ["DATA_LINE",site]
data << u.login
data << u.permission_rule_set.display_name
data << u.custom_home_page.id
data << u.custom_home_page.name || ''
data << u.custom_home_page.page_type || ''
@pboucher
pboucher / find_tags_field.rb
Created April 20, 2017 22:21
Find any field called tags or sg_tags on hosted infrastructure.
DisplayColumn.find(:all, :conditions=>{:name=>'tags'}).each do |dc|
puts "Found tag field|#{ENV['RAILS_ENV']}|{#{dc.entity_type}"
end
DisplayColumn.find(:all, :conditions=>{:name=>'sg_tags'}).each do |dc|
puts "Found sg_tags field|#{ENV['RAILS_ENV']}|{#{dc.entity_type}"
end
@pboucher
pboucher / ami_count.rb
Last active December 7, 2015 23:08
AMI Count
puts "AMI count on #{ShotgunConfig.instance['hostname']}: #{ActionMenuItem.find(:all).length}" if ActionMenuItem.find(:all).length > 0
@pboucher
pboucher / itunes.plugin.zsh
Created October 20, 2012 04:54
iTunes plugin for oh-my-zsh
# ------------------------------------------------------------------------------
# FILE: iTunes.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file to control iTunes
# AUTHOR: Patrick Boucher (pboucher@patrickboucher.com)
# VERSION: 1.0
# ------------------------------------------------------------------------------
function play() {
osascript 2>/dev/null <<EOF
tell application "iTunes" to play
@pboucher
pboucher / recreateMaterials.py
Created March 28, 2011 16:42
Try to recreate a material from scratch as a helper / workaround for disconnecting shaders...
import functools
from win32com.client import constants as c
xsi = Application
log = xsi.LogMessage
INDENT = ' '
@pboucher
pboucher / MatLibFix.py
Created March 24, 2011 19:54
Try to recreate material libraries to fix the disconnecting shaders issue.
from win32com.client import constants as c
xsi = Application
log = xsi.LogMessage
def XSILoadPlugin(reg):
reg.Author = "pboucher"
reg.Name = "MatLibFix"
reg.Major = 1
reg.Minor = 0
@pboucher
pboucher / SI_CodeRunner.py
Created March 18, 2011 15:02
Plugin to run code in scene annotations when Softimage events occur.
SI_GLOBALS = globals().copy()
import traceback
from win32com.client import constants as c
xsi = Application
log = xsi.LogMessage
ACTIVE_EVENTS = [
@pboucher
pboucher / shotgunWrapTest.py
Created February 18, 2011 23:19
Experimenting extending Shotgun to return custom objects instead of simple dicts.
import pprint
import sys
import shotgun_api3 as sg
class Shotgun(sg.Shotgun):
__registry = {}
def __init__(self, *args, **kwargs):
super(Shotgun, self).__init__(*args, **kwargs)
@pboucher
pboucher / SetValue.py
Created January 19, 2011 18:08
SetValue decorator for Softimage that can temporarily change any value for the duration of a method call and restore it afterward. Originally posted at http://www.softimageblog.com/archives/357
import functools
xsi = Application
def tempSetValues(newVals):
def closure(func):
@functools.wraps(func)
def inner(*args, **kwargs):
# Save current values and set new ones
oldVals = {}