This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HDCP MASTER KEY (MIRROR THIS TEXT!) | |
This is a forty times forty element matrix of fifty-six bit | |
hexadecimal numbers. | |
To generate a source key, take a forty-bit number that (in | |
binary) consists of twenty ones and twenty zeroes; this is | |
the source KSV. Add together those twenty rows of the matrix | |
that correspond to the ones in the KSV (with the lowest bit | |
in the KSV corresponding to the first row), taking all elements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# drops to imedo.de | |
class ApplicationController < ActionController::Base | |
around_filter :log_crawlers, :unless => :logged_in? | |
def log_crawlers | |
action_start = Time.now | |
yield | |
duration = Time.now - action_start | |
Crawling.log(request, duration) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ostruct' | |
class ROpenStruct < OpenStruct | |
def table | |
@table ||= {} | |
end | |
def method_missing(mid, *args) | |
mname = mid.id2name | |
len = args.length |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DynamicAttributes | |
class DynamicAttributesError < StandardError; end; | |
def self.included(base) | |
base.send(:include, InstanceMethods) | |
base.send(:extend, ClassMethods) | |
end | |
module ClassMethods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CallerMethodName | |
extend self | |
def caller_method_name | |
parse_caller(caller(2).first).last | |
end | |
def parse_caller(at) | |
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at | |
file = Regexp.last_match[1] | |
line = Regexp.last_match[2].to_i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# ANSI color codes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: mongodb | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the mongodb data-store | |
# Description: starts mongodb using start-stop-daemon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord | |
class Base | |
# updates a single attribute on the record directly to the database using | |
# ActiveRecord::Base.update_all | |
def update_single_attribute(name, value) | |
write_attribute(name, value) | |
self.class.update_all({name => value}, {self.class.primary_key => read_attribute(self.class.primary_key)}, {:limit => 1}) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'prawn/measurement_extensions.rb' | |
class StandardBriefB < Prawn::Document | |
def initialize(*args) | |
super( | |
:page_size => 'A4', | |
:page_layout => :portrait, | |
:margin => [107.4.mm, 8.1.mm, 30.mm, 24.1.mm] | |
) | |
options = args.last.is_a?(Hash) ? args.last : {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add Template Identification HTML Comments to ERB output | |
module ::ActionView | |
module TemplateHandlers | |
class ERB < TemplateHandler | |
include Compilable | |
cattr_accessor :erb_trim_mode | |
self.erb_trim_mode = '-' | |
def compile(template) | |
buf = <<-HTML | |
<% unless request and request.xhr? %> |