code
stringlengths
1
1.73M
language
stringclasses
1 value
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory # # this sample script fixes a bug in some GTK libs (eg debian) where at some point # when you close a window an invalid memory dereference i...
Ruby
#!/usr/bin/env ruby # This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm' $opts = { :execlass => Metasm::ELF, :exetype => :lib } load File.join(File.dirname(__FILE__), 'exeencode...
Ruby
#!/usr/bin/env ruby # This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory # # this script reads a list of elf files, and lists its dependencies recursively # libraries are searched in LD_LIBRARY_...
Ruby
#!/usr/bin/env ruby # This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory # # this script disassembles an executable (elf/pe) and dumps the output # ruby -h for help # require 'metasm' include M...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory # # This exemple illustrates the usage of the C parser to compute the offset of members of a given structure # usage: struct_offset.rb <c file...
Ruby
#!/usr/bin/env ruby # This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory # # this script disassembles an executable (elf/pe) using the GTK front-end # use live:bla to open a running process whos...
Ruby
#!/usr/bin/ruby # This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory # # this exemple illustrates the use of the PTrace class to hijack a syscall in a running process # the next syscall made is ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory Dir['tests/*.rb'].sort.each { |f| require f }
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'test/unit' require 'metasm' class TestDynldr < Test::Unit::TestCase def d; Metasm::DynLdr; end def test_new_api_c str = "1234" ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'test/unit' require 'metasm/exe_format/shellcode' class TestEncodedData < Test::Unit::TestCase def compile(src) p = Metasm::Shell...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'test/unit' require 'metasm/preprocessor' require 'metasm/parse' # BEWARE OF TEH RUBY PARSER # use single-quoted source strings cla...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'test/unit' require 'metasm' class TestIa32 < Test::Unit::TestCase @@cpu32 = Metasm::Ia32.new @@cpu16 = Metasm::Ia32.new(16) def ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'test/unit' require 'metasm' class TestDynldr < Test::Unit::TestCase def cp @cp ||= Metasm::Ia32.new.new_cparser end def test_p...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'test/unit' require 'metasm' class TestPreproc < Test::Unit::TestCase include Metasm def asm_dasm(src) @cpu ||= Ia32.new raw ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'test/unit' require 'metasm' class TestArc < Test::Unit::TestCase def test_arc_dec hex_stream = "\x0A\x23\x80\x0F\x80\x...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'test/unit' require 'metasm' class TestExpression < Test::Unit::TestCase E = Metasm::Expression def test_encode assert_equal("\x...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'test/unit' require 'metasm' class TestX86_64 < Test::Unit::TestCase @@cpu = Metasm::X86_64.new def assemble(src, cpu=@@cpu) Met...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory # special file to test the graph layout engine # call this file directly to run require 'metasm' include Metasm def test_layout(lo) $cur |...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'test/unit' require 'metasm' class TestMips < Test::Unit::TestCase def test_enc sc = Metasm::Shellcode.assemble(Metasm::MIPS.new(...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
require 'rubygems' require 'date' SPEC = Gem::Specification.new do |s| s.name = "callcache" s.version = "0.2.0" s.author = "Adam Wisniewski" s.email = "adamw@tbcn.ca" s.date = s.date = Date.today.to_s s.homepage = "http://www.tbcn.ca/callcache" s.platform = Gem::Platform::RUBY s.summary = "Ruby...
Ruby
# rakefile.rb # February 21, 2007 # require 'rake' require 'rake/testtask' require 'rake/rdoctask'
Ruby
#============================================================================= # # Copyright 2007 Adam Wisniewski <adamw@tbcn.ca> # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of # the License at # # http:/...
Ruby
#============================================================================= # # Copyright 2007 Adam Wisniewski <adamw@tbcn.ca> # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of # the License at # # http:/...
Ruby
#============================================================================= # # Copyright 2007 Adam Wisniewski <adamw@tbcn.ca> # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of # the License at # # http:/...
Ruby
#============================================================================= # # Copyright 2007 Adam Wisniewski <adamw@tbcn.ca> # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of # the License at # # http:/...
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person',...
Ruby
# These settings change the behavior of Rails 2 apps and will be defaults # for Rails 3. You can remove this initializer when Rails 3 is released. if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveRecord::Base.include_root_in_json = true # Store the full clas...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# replace with the name of your application set :application, "endar" # replace with the HTTP (NOT HTTPS) read-only URL of your Google Code SVN set :repository, "http://calorganizer.googlecode.com/svn/trunk/endar" # directory for deployment on remote machine set :deploy_to, "/mnt/app" # If you aren't using Subversio...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = false # Enable threaded mode # config.threadsafe! # Use a different logger for distributed setups # config...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.ca...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between...
Ruby
# Be sure to restart your server when you modify this file # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present # RAILS_GEM_VERSION = '2...
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
ActionController::Routing::Routes.draw do |map| map.with_options( :controller => 'endar_event') do |m_user| #m_user.connect "user/new", :action => 'new' #m_user.connect 'profile/:login', :action => 'show' m_user.connect '', :action => 'index' end # The priority is based upon order of creation: first created...
Ruby
load 'deploy' if respond_to?(:namespace) # cap2 differentiator Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } Dir['lib/recipes/*.rb'].each { |plugin| load(plugin) } load 'config/deploy'
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module EndarEventTimeHelper end
Ruby
module EndarEventHelper end
Ruby
module EndarUserHelper end
Ruby
module EndarUserTimeHelper end
Ruby
class EndarUserTime < ActiveRecord::Base belongs_to :endar_user validates_numericality_of :user_id validates_presence_of :date_begin validates_presence_of :date_end def self.save(upload) name = upload['datafile'].original_filename just_filename = File.basename(name) if File.extname(just_filename...
Ruby
class EndarEvent < ActiveRecord::Base has_many :endar_users has_many :endar_event_times validates_presence_of :name validates_presence_of :duration end
Ruby
class EndarUser < ActiveRecord::Base has_many :endar_user_times belongs_to :endar_event validates_numericality_of :event_id validates_presence_of :name #validates_presence_of :password #validates_presence_of :login #validates_presence_of :email #validates_confirmation_of :email #validates_uniqueness_of :logi...
Ruby
class InviteUsers < ActionMailer::Base def invite(recipient, user, event, sent_at = Time.now) subject 'CalEndar: Meeting time setup for ' + '"' + event.name + '"' recipients recipient from 'CalEndar169@gmail.com' sent_on sent_at body :event => event, :user => user ...
Ruby
class EndarEventTime < ActiveRecord::Base belongs_to :endar_event validates_numericality_of :event_id validates_presence_of :date_begin validates_presence_of :date_end validates_numericality_of :count end
Ruby
require 'rubygems' # Unless you install from the tarball or zip. require 'icalendar' require 'date' require 'net/https' require 'net/http' require 'rexml/document' require 'open-uri' require 'uri' require 'cgi' require 'gdata' #require 'googlecalendar' include Icalendar # Probably do this in your class to limit namesp...
Ruby
class EndarEventTimeController < ApplicationController layout 'standard' def new @event_time = EndarEventTime.new end def create @event_time = EndarEventTime.new(params[:event_time]) @event_time[:event_id] = 0 @event_time[:count] = 0 if @event_time.save redirect_to :controller => 'endar_eve...
Ruby
class EndarUserController < ApplicationController layout 'standard' # list returns the information needed for user/list.rhtml def list @event = EndarEvent.find(params[:id]) @user = EndarUser.find(:all, :conditions => ["event_id = ?", params[:id]]) end # show is called for each item in @users in user/list....
Ruby
class EndarPublicController < ApplicationController layout 'standard' def show render :controller => 'endar_public', :action => params[:id] end def contact end def thanks @comment = params[:comment] @name = params[:name] puts "COMMENT" InviteUsers.deliver_comment("CalEndar169@gmail.c...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details...
Ruby
require 'rubygems' # Unless you install from the tarball or zip. require 'icalendar' require 'date' include Icalendar class EndarEventController < ApplicationController layout 'standard' $utc_flag = 1 def new @event = EndarEvent.new @event.endar_event_times.build #Email users link to events/show/id...
Ruby
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'tasks/rails'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
class CreateEndarEventTimes < ActiveRecord::Migration def self.up create_table :endar_event_times do |t| t.column :event_id, :integer, :null => false t.column :date_begin, :datetime t.column :date_end, :datetime t.column :time_begin, :time t.column :time_end, :time t.column :count, :integer, :defaul...
Ruby
class EndarUsers < ActiveRecord::Migration def self.up end def self.down end end
Ruby
class EndarEventTimes < ActiveRecord::Migration def self.up end def self.down end end
Ruby
class EndarEvents < ActiveRecord::Migration def self.up end def self.down end end
Ruby
class CreateEndarUserTimes < ActiveRecord::Migration def self.up create_table :endar_user_times do |t| t.column :user_id, :integer, :null => false t.column :date_begin, :datetime t.column :date_end, :datetime t.column :is_free, :integer t.column :created_at, :timestamp t.column :updated_at, :timesta...
Ruby
class CreateEndarUsers < ActiveRecord::Migration def self.up create_table :endar_users do |t| t.column :event_id, :integer, :null => false t.column :name, :string, :limit => 32, :null => false t.column :email_sent, :integer t.column :created_at, :timestamp t.column :updated_at, :timestamp ...
Ruby
class CreateEndarEvents < ActiveRecord::Migration def self.up create_table :endar_events do |t| t.column :name, :string, :limit => 32, :null => false t.column :description, :text, :limit => 256 t.column :duration, :integer, :null => false t.column :admin, :string, :limit => 32, :null => false t...
Ruby
class EndarUserTimes < ActiveRecord::Migration def self.up end def self.down end end
Ruby
namespace :deploy do namespace :mongrel do set :mongrel_clean, false set :mongrel_rails, 'mongrel_rails' set :mongrel_conf, nil def set_mongrel_conf set :mongrel_conf, "/etc/mongrel.yml" unless mongrel_conf end desc "Setup mongrel cluster configuration" task :configure, :ro...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the Fast...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the Fast...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class Test::Unit::TestCase # Transactional fixtures accelerate your tests by wrapping each test method # in a transaction that's rolled back on completion. This ensures that the # test datab...
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # i...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby