Skip to content

Instantly share code, notes, and snippets.

View biilmann's full-sized avatar
💭
Waiting for pod to exist...

Mathias Biilmann biilmann

💭
Waiting for pod to exist...
View GitHub Profile
# Run rotr server
pipe = IO.popen('rots')
at_exit do
Process.kill 'TERM', pipe.pid
pipe.close
end
source 'http://gemcutter.org'
gem "rails", "3.0.0.beta"
gem "activerecord-jdbc-adapter", '0.9.3', :require =>'jdbc_adapter' if defined?(JRUBY_VERSION)
gem 'mongoid', :git => 'git://github.com/durran/mongoid.git', :branch => 'prerelease'
gem "jdbc-sqlite3"
gem "uuidtools"
gem "json-jruby"
gem "jruby-openssl"
require 'java'
require 'rubygems'
require 'nokogiri'
data = %[<?xml version="1.0" encoding="UTF-8"?>
<auth_createToken_response xmlns="http://api.facebook.com/1.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
3e4a22bb2f5ed75114b0fc9995ea85f1
</auth_createToken_response>]
[mbc@mbcbook-2 primordial-soup (cucumber)]$ ruby script/cucumber
Using the default profile...
DEPRECATION WARNING: RAILS_ROOT is deprecated! Use Rails.root instead. (called from join at /Users/mbc/.bundle/gems/compass-0.8.17/lib/compass/configuration.rb:137)
uninitialized constant ActionDispatch::Integration::Session::Test (NameError)
/Users/mbc/.bundle/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:116:in `const_missing'
/Users/mbc/.bundle/gems/actionpack-3.0.0.beta/lib/action_dispatch/testing/integration.rb:127
/Users/mbc/.bundle/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:169:in `require'
/Users/mbc/.bundle/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:169:in `require'
/Users/mbc/.bundle/bundler/gems/cucumber-rails-625d6ba1c12badd9982f14c269b4f799c93ba3c9-master/lib/cucumber/rails/world.rb:22
/Users/mbc/.bundle/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:169:in `require'
rots = IO.popen("rots")
a = rots.readline
Process.kill(9, rots.pid)
puts a
class CookieTestController < ApplicationController
def set_cookie
cookies.delete :hello
cookies[:hello] = { :value => "Hello there at #{Time.now}!", :expires => 2.weeks.from_now }
render :text => "cookie set to: #{cookies[:hello]}"
end
 
def view_cookie
render :text => "Cookie: #{cookies[:hello]}"
end
2010-03-23_17:31:09.75285 merb : worker (port 4000) ~ Started request handling: Tue Mar 23 17:31:09 +0000 2010
2010-03-23_17:31:09.75285 merb : worker (port 4000) ~ Routed to: {"format"=>nil, "action"=>"show", "id"=>"admin", "controller"=>"chef_server_api/users"}
2010-03-23_17:31:09.75285 merb : worker (port 4000) ~ Params: {"format"=>nil, "action"=>"show", "id"=>"admin", "controller"=>"chef_server_api/users"}
2010-03-23_17:31:09.75285 DEBUG: Headers in authenticate_every: {:connection=>"close", :x_ops_authorization_5=>"HCulP3p72lwuu7Y5Q0h6VfuY1Fjer3QPcmNtAKnegzSik44Yw8qiYDVTo4tx", :x_chef_version=>"0.8.6", :x_ops_authorization_6=>"bz3uVjSWvY1hWHsfGB0+IOuw/IHk2GA3V9Y4gqOWYg==", :x_ops_timestamp=>"2010-03-23T17:31:09Z", :accept=>"application/json", :x_ops_authorization_1=>"sSFVi1nSWccEl0nU21xtF3+Ukjb7C1ImjK6ySbMMpwC7qyfJb3PleVEFt+dS", :x_ops_userid=>"chef-webui", :x_ops_authorization_2=>"JOin9xrhEbk1DifDIQJQ4g68JPF9ojoyxuv2/2NZAptNlnd5ILHp4llWzyBp", :x_ops_content_hash=>"2jmj7l5rSw0yVb/vlWAYkK/YBwk=", :x_ops_s
Loading init file from ./config/init.rb
~ Loaded slice 'ChefServerWebui' ...
/usr/local/lib/ruby/gems/1.8/gems/ruby-openid-2.1.6/lib/openid.rb:16: warning: already initialized constant VERSION
/usr/local/lib/ruby/1.8/cgi.rb:279: warning: already initialized constant CR
/usr/local/lib/ruby/1.8/cgi.rb:282: warning: already initialized constant LF
/usr/local/lib/ruby/1.8/cgi.rb:285: warning: already initialized constant EOL
/usr/local/lib/ruby/1.8/cgi.rb:287: warning: already initialized constant REVISION
/usr/local/lib/ruby/1.8/cgi.rb:292: warning: already initialized constant PATH_SEPARATOR
/usr/local/lib/ruby/1.8/cgi.rb:313: warning: already initialized constant HTTP_STATUS
/usr/local/lib/ruby/1.8/cgi.rb:317: warning: already initialized constant RFC822_DAYS
bash "Untar narwhal" do
cwd narwhal[:untar]
code "tar xzf #{narwhal[:file]}"
action :nothing
end
# Download narwhal
remote_file narwhal[:file] do
source narwhal[:link]
checksum narwhal[:sha]
A backup of http://sites.google.com/site/redcodenl/creating-shazam-in-java-1 just in case
Why is this necessary? Read http://sites.google.com/site/redcodenl/patent-infringement
Please fork, tweet about, etc.
----
Creating Shazam in Java
A couple of days ago I encountered this article: How Shazam Works
This got me interested in how a program like Shazam works… And more importantly, how hard is it to program something similar in Java?