Skip to content

Instantly share code, notes, and snippets.

View julik's full-sized avatar
💭
🎺

Julik Tarkhanov julik

💭
🎺
View GitHub Profile
@julik
julik / fork_and_forget.rb
Created April 8, 2013 08:07
Le fork and forget picked up on Pastebin
#! /usr/bin/env ruby
# "Fork and Forget"
# Don't wait if you don't have to: A mini-tutorial about concurrency
# mechanisms in Ruby and basic Unix systems programming, and how you can use
# them to avoid waiting.
#
# I have heard that people are occasionally unfamiliar with this strategy.
# It's a common idiom, regardless of language, and it is also essentially built
# into Erlang (and Termite Scheme, etc.).
#
@julik
julik / sortof.rb
Last active December 15, 2015 11:49
def path
super || own_computed_path
end
private
def own_computed_path
path_components = [parent_path]
if node_id && !parent_path.empty?
path_components.push '[%s]' % node_id
class OxMama
def path
end
end
class WyrwiGlaz < OxMama
def parent_path
'junk'
end
@julik
julik / namespace.coffee
Created March 24, 2013 17:29
A wrapper to let everything you define happen under the window.app object
using = (context, args..., f) -> f.apply(context, args)
window.app = {}
window.inApp = (f) ->
using window.app, f
@julik
julik / cornerpin_centroid.py
Created January 23, 2013 16:02
This baby will compute the center pivot of a CornerPin node in Nuke
import nuke
def run():
cornerpin = nuke.selectedNode()
xform = nuke.nodes.TransformMasked()
xform["center"].setAnimated()
f = nuke.frame()
center = xform["center"]
xanim = center.animations()[0]
@julik
julik / manual_mount.rb
Created October 7, 2012 13:17
Manually mount HFS shares on OSX
#!/usr/bin/env ruby
require 'fileutils'
MOUNTZ = %w(
some-server.company.local:/mnt/raiddisk/commercial /mnt/commercial
)
SERVERS = Hash[*MOUNTZ]
MAGIC_OPTS = %w( soft resvport intr rsize=8192 wsize=8192 timeo=900 retrans=3 proto=tcp )
@julik
julik / slip nuke anims
Created September 8, 2012 11:24
slips.py
import nuke, re
def slip_animations_of_node(node, by_offset):
"""
This function will slip all the animations of the passed node by a passed
offset in frames
The animations are offset in the passed TCL curve command.
In this script every frame at which keys are placed is marked by x<FRAME_NUMBER>,
and these are only placed at the start of a non-continuous segment.
@julik
julik / slip.py
Created July 30, 2012 15:07
Offset and slip ALL OF EM KEYFRAMES on nodes
import nuke, re
def start_anim_at(node, frame):
"""
Will move all the animations of the passed node so that they start at the passed frame instead of the
current ont
"""
slip_by = frame - first_keyframe_location(node)
slip_animations_of_node(node, slip_by)
@julik
julik / consolidate.rb
Created July 9, 2012 15:57
Consolidate all used takes (first in point to last out point) from all EDLs in this directory (writes to STDOUT)
require 'edl'
class ConsolidatedClip
attr_reader :in, :out, :reel, :members
def initialize(members)
@in = members.map {|e| e.capture_from_tc }.sort[0]
@out = members.map {|e| e.capture_to_tc }.sort[-1]
@reel = members[0].reel
@members = members
end
@julik
julik / flip2d.szl
Created July 5, 2012 13:05
Flip your trackers in the image plane in 2D
//SIZZLET Flip Selected Trackers In 2D
obj = Scene.activeObj
shot = obj.shot
frameFrom = shot.start
frameTo = shot.stop
for (tk in obj.trk)
if (tk.isSel == 1)
tk.isDone = 0