Skip to content

Instantly share code, notes, and snippets.

View metacritical's full-sized avatar
Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
@metacritical
metacritical / play.rb
Created November 28, 2011 20:06
Ruby video player implemented using HornetsEye
require 'rubygems'
require 'hornetseye_ffmpeg'
require 'hornetseye_xorg'
require 'hornetseye_alsa'
include Hornetseye
input = AVInput.new 'sintel.mp4'
alsa = AlsaOutput.new 'default:0', input.sample_rate, input.channels
audio_frame = input.read_audio
X11Display.show 600, :output => XVideoOutput do |display|
img = input.read
@metacritical
metacritical / gist:1404985
Created November 29, 2011 14:30 — forked from seanlilmateus/gist:1386468
Macruby Face Detection in Mac OS X Lion
framework 'Cocoa'
framework 'QuartzCore'
class NSColor
def toCGColor
colorRGB = self.colorUsingColorSpaceName NSCalibratedRGBColorSpace
components = Array.new(4){Pointer.new(:double)}
colorRGB.getRed components[0], green:components[1], blue:components[2], alpha:components[3]
@metacritical
metacritical / csv_parser_csv_gem_benchmark.rb
Created November 29, 2011 15:39 — forked from bytesource/csv_parser_csv_gem_benchmark.rb
Simple CSV Parser vs. CSV Gem Benchmark
require 'open-uri'
require 'nokogiri'
require 'parslet'
require 'csv'
# --------------------------------------------------
# Auxiliary code
class String
@metacritical
metacritical / widget.rb
Created December 8, 2011 22:54 — forked from maccman/widget.rb
MacRuby Webkit Interface
framework "WebKit"
class Widget
class RPC
class << self
public :include
end
def initialize(widget)
@widget = widget
@metacritical
metacritical / .htaccess
Created December 9, 2011 23:11 — forked from BrandonMathis/.htaccess
sinatra htaccess for bluehost
# General Apache options
AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi
#Options +FollowSymLinks +ExecCGI
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
# Adapted from a script by Evan Phoenix
require 'benchmark'
GC::Profiler.enable
class Simple
attr_accessor :next
end
top = Simple.new
@metacritical
metacritical / README.md
Created February 24, 2012 01:40 — forked from netmute/README.md
Game of Life

Game of Life

An implementation of Conway's Game of Life in 140 characters of Ruby.

Author

Created by Simon Ernst (@sier).

@metacritical
metacritical / bf2asm.rb
Created August 27, 2012 05:09 — forked from ujihisa/bf2asm.rb
brainf**k compiler for 32bit X86 Linux
puts DATA.read
labelnum = 0
labelstack = []
ARGF.each_char do |c|
puts " # #{c}"
case c
when '>'
puts ' addl $4, %eax'
when '<'
@metacritical
metacritical / simple_args_parsing.sh
Created August 27, 2012 18:46 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@metacritical
metacritical / simple_args_parsing.sh
Created August 27, 2012 18:47 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"