Skip to content

Instantly share code, notes, and snippets.

View julik's full-sized avatar
💭
🎺

Julik Tarkhanov julik

💭
🎺
View GitHub Profile
@julik
julik / config.ru
Created February 29, 2012 18:26
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
require "rails"
# Let's load only action controller. If you want
# to use active record, just require it as well.
require "action_controller/railtie"
class MyApp < Rails::Application
@julik
julik / composition-normalization-and-morons.markdown
Created February 17, 2012 09:43
Композиция, нормализация и уроды

В своих разговорах о Юникоде я не затронул несколько интересных моментов, о которых полезно знать. Кофейный столик "Юлик о Юникоде" продолжает прием посетителей.

Байт, кодпойнт, глиф

Юникод - многобайтовый способ кодирования текста. Текст состоит из codepoints (кодовых позиций), все позиции присутствуют в каталоге символов Unicode. Кодпойнты включают базовые компоненты графем и графемы в целом. При этом:

Каждый кодпойнт можно выразить в байтовом виде как минимум 5 разными способами

Один из них - UTF-8, в котором все латинские буквы заменены на однобайтовые ASCII-эквиваленты. Другие варианты - UTF-16 и UTF-32. UTF-16 - стандартный способ хранения Unicode-строк в операционных системах. InDesign импортирует тексты именно в UTF-16 например.

bigbuk-2:framecurve julik$ rvm use 1.8.7
Using /Users/julik/.rvm/gems/ruby-1.8.7-p334
bigbuk-2:framecurve julik$ gem install flame_channel_parser
Fetching: term-ansicolor-1.0.7.gem (100%)
Fetching: framecurve-1.0.2.gem (100%)
Fetching: flame_channel_parser-4.0.2.gem (100%)
Successfully installed term-ansicolor-1.0.7
Successfully installed framecurve-1.0.2
Successfully installed flame_channel_parser-4.0.2
3 gems installed
@julik
julik / splice_cornerpins.rb
Created December 27, 2011 18:06
Splice two cornerpin tracks from Syntheyes
require "rubygems"
require "tracksperanto"
first_trackers = File.open('24prio_cornerpin.txt') do | f |
Tracksperanto::Import::Syntheyes.new(:io => f, :width => 1024, :height => 576).to_a
end
second_trackers = File.open('77overig_cornerpin.txt') do | f |
Tracksperanto::Import::Syntheyes.new(:io => f, :width => 1024, :height => 576).to_a
end
@julik
julik / median.rb
Created November 16, 2011 18:48
Median tracker point
require "tracksperanto"
# Computes The Nodal That Never Is
class Tracksperanto::Median
def transform(tracker_enum)
# Make all keyframes zero-based with regards to the first keyframe (so that
# all tracks start at the 0 point)
min_f, max_f = 0, 0
tracker_enum.each do | t |
zero_x, zero_y = t[0].abs_x, t[0].abs_y
@julik
julik / transactional.rb
Created November 1, 2011 18:27
Transactional database in Minitest in 7 lines of code
module TransactionalTests
# See minitest doco - use_transactional_fixtures_but_in_ruby
# to use include this into your test case
def run(runner)
test_result = nil
ActiveRecord::Base.transaction { test_result = super; raise ActiveRecord::Rollback }
test_result
end
end
@julik
julik / disable.txt
Created October 19, 2011 16:24
Disable the fucking Wacom touchstrips on Flame
> From: Glenn Clyatt
>
> I disable(comment) pad in '/etc/X11/xorg.conf' and it saves tons of
> heartache.
> New install or running fixconfig will undo it.
>
> something like this:
>
> @ line 56-
> # InputDevice "pad"
@julik
julik / reducer.py
Created September 16, 2011 16:22
Iteratively reduce keyframes on linear segments in Nuke
import math
DELTA = 0.0001
def is_linear_segment(before, current, after, delta):
dx = after.x - before.x
dy = after.y - before.y
t = (current.x - before.x) / dx
linear_y = before.y + (dy * t)
return math.fabs(linear_y - current.y) < delta
@julik
julik / callback.py
Created September 15, 2011 14:49
nuke callback on specific node
## this ??
b = nuke.createNode("Blur")
b['knobChanged'].setValue('''
k = nuke.thisKnob()
if k.name() == "size":
nuke.message("%s" % nuke.thisNode()["size"].value())'''
)
@julik
julik / unfuck_osx_readline_for_ruby.txt
Created August 24, 2011 13:10
Decent Readline support for irb/pry on Leopard and above for decent UTF8 input, with RVM
Ensure that your ~/.inputrc contains this
set convert-meta off
set input-meta on
set output-meta on
Install the REAL GNU readline from source
$ curl ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz | tar xfz - && cd readline-6.2 && ./configure --enable-multibyte && make && sudo make install