source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | davidesantangelo/emailhunter | https://github.com/davidesantangelo/emailhunter | lib/email_hunter/api.rb | Ruby | mit | 46 | master | 3,745 | # frozen_string_literal: true
require 'uri'
%w[exist search finder verify count account company people discover leads campaigns lead_enrichment company_enrichment
combined_enrichment].each do |file|
require_relative file
end
module EmailHunter
# Main API client for EmailHunter services
class Api
attr_re... |
github | davidesantangelo/emailhunter | https://github.com/davidesantangelo/emailhunter | lib/email_hunter/exist.rb | Ruby | mit | 46 | master | 733 | # frozen_string_literal: true
require 'faraday'
require 'json'
module EmailHunter
class Exist
API_URL = 'https://api.emailhunter.co/v1/exist'
attr_reader :email, :key
def initialize(email, key)
@email = email
@key = key
end
def hunt
response_data = fetch_exist_data
ret... |
github | davidesantangelo/emailhunter | https://github.com/davidesantangelo/emailhunter | lib/email_hunter/campaigns.rb | Ruby | mit | 46 | master | 3,772 | # frozen_string_literal: true
require 'faraday'
require 'json'
require 'ostruct'
module EmailHunter
class Campaigns
API_URL = 'https://api.hunter.io/v2/campaigns'
attr_reader :key, :params, :action, :campaign_id, :data
def initialize(key, action: :list, campaign_id: nil, data: nil, params: {})
@... |
github | davidesantangelo/emailhunter | https://github.com/davidesantangelo/emailhunter | lib/email_hunter/lead_enrichment.rb | Ruby | mit | 46 | master | 1,747 | # frozen_string_literal: true
require 'faraday'
require 'json'
require 'ostruct'
module EmailHunter
class LeadEnrichment
API_URL = 'https://api.hunter.io/v2/people/find'
attr_reader :key, :email, :linkedin
def initialize(key, email: nil, linkedin: nil)
@key = key
@email = email
@link... |
github | davidesantangelo/emailhunter | https://github.com/davidesantangelo/emailhunter | lib/email_hunter/search.rb | Ruby | mit | 46 | master | 1,096 | # frozen_string_literal: true
require 'faraday'
require 'json'
module EmailHunter
class Search
API_URL = 'https://api.hunter.io/v2/domain-search'
attr_reader :domain, :key, :params
def initialize(domain, key, params = {})
@domain = domain
@key = key
@params = params
end
def ... |
github | davidesantangelo/emailhunter | https://github.com/davidesantangelo/emailhunter | spec/emailhunter_spec.rb | Ruby | mit | 46 | master | 7,616 | # frozen_string_literal: true
require 'spec_helper'
require 'vcr'
describe EmailHunter do
let(:key) { '78fe0358ef51006a14b04aff1ea3e3665dac8118' }
it 'has a version number' do
expect(EmailHunter::VERSION).not_to be nil
end
it 'has an api_key' do
expect(key).not_to eq('your api key')
expect(key).... |
github | davidesantangelo/emailhunter | https://github.com/davidesantangelo/emailhunter | spec/support/vcr_setup.rb | Ruby | mit | 46 | master | 229 | # frozen_string_literal: true
# spec/support/vcr_setup.rb
VCR.configure do |c|
# the directory where your cassettes will be saved
c.cassette_library_dir = 'spec/vcr'
# your HTTP request service
c.hook_into :typhoeus
end |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | spielbash.gemspec | Ruby | mit | 46 | master | 1,326 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "spielbash/version"
Gem::Specification.new do |spec|
spec.name = "spielbash"
spec.version = Spielbash::VERSION
spec.authors = ["Anton Malinskiy"]
spec.email = ["anton@malinski... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | spec/record_interactor_spec.rb | Ruby | mit | 46 | master | 316 | require 'spec_helper'
RSpec.describe 'RecordInteractor' do
before do
File.delete('/tmp/output.json') if File.exists?('/tmp/output.json')
end
it 'should record movie' do
interactor = Spielbash::RecordInteractor.new
interactor.execute(file_fixture('scenario_1.yaml'), '/tmp/output.json')
end
end |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | spec/spec_helper.rb | Ruby | mit | 46 | master | 749 | require 'simplecov'
require 'bundler/setup'
require 'spielbash/spielbash'
module FileFixtures
def file_fixture(fixture_name)
path = Pathname.new(File.join('spec/fixtures/files', fixture_name))
if path.exist?
path
else
msg = "the directory '%s' does not contain a file named '%s'"
raise ... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/spielbash.rb | Ruby | mit | 46 | master | 598 | require 'spielbash/interactor/record_interactor'
require 'spielbash/model/movie'
require 'spielbash/model/context'
require 'spielbash/model/session'
require 'spielbash/model/action/base_action'
require 'spielbash/model/action/message_action'
require 'spielbash/model/action/press_key_action'
require 'spielbash/model/act... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/interactor/record_interactor.rb | Ruby | mit | 46 | master | 3,465 | require 'yaml'
module Spielbash
class RecordInteractor
def execute(script_path, output_path)
script = YAML.load_file(script_path)
title = script['title']
opts = script['options']
typing_delay_s = opts['typing_delay_s']
reading_delay_s = opts['reading_delay_s']
wait = opts['wa... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/view/cli.rb | Ruby | mit | 46 | master | 1,420 | module Spielbash
module CLI
require 'gli'
include GLI::App
extend self
program_desc 'Tool to automate bash movie-making with asciinema. Be the Spielberg of bash'
desc 'Be verbose'
switch [:v, :verbose]
# Cross-platform way of finding an executable in the $PATH.
#
# which('rub... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/model/session.rb | Ruby | mit | 46 | master | 3,485 | require 'childprocess'
require 'tempfile'
require 'mkmf'
module Spielbash
class Session
attr_accessor :context, :name, :output_path
attr_reader :last_stdout, :last_stderr
def initialize(name, output_path, context)
@context = context
@name = name
@output_path = output_path
ChildP... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/model/movie.rb | Ruby | mit | 46 | master | 1,023 | module Spielbash
class Movie
attr_accessor :title, :pre_run_actions, :actions, :post_run_actions, :context, :output_path, :session
def initialize(title, pre_run_actions, actions, post_run_actions, context, output_path)
@title = title
@pre_run_actions = pre_run_actions
@actions = actions
... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/model/context.rb | Ruby | mit | 46 | master | 423 | module Spielbash
class Context
attr_accessor :typing_delay_s, :reading_delay_s, :wait, :width, :height, :wait_check_cmd
def initialize(typinig_delay_s, reading_delay_s, wait, width, height, wait_check_cmd = nil)
@typing_delay_s = typinig_delay_s
@reading_delay_s = reading_delay_s
@wait = wa... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/model/action/message_context.rb | Ruby | mit | 46 | master | 309 | module Spielbash
class MessageContext < Spielbash::ActionContext
attr_accessor :delete
def initialize(base_context, typing_delay_s, reading_delay_s, wait, width, height, delete)
super(base_context, typing_delay_s, reading_delay_s, wait, width, height)
@delete = delete
end
end
end |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/model/action/action_context.rb | Ruby | mit | 46 | master | 604 | module Spielbash
class ActionContext < Spielbash::Context
attr_accessor :base_context
def initialize(base_context, typing_delay_s, reading_delay_s, wait, width, height)
super(typing_delay_s, reading_delay_s, wait, width, height)
@base_context = base_context
end
def typing_delay_s
r... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/model/action/delete_environment_action.rb | Ruby | mit | 46 | master | 477 | module Spielbash
class DeleteEnvironmentAction < Spielbash::BaseAction
attr_accessor :command
def initialize(command, root_context)
super(root_context)
@command = command
end
def execute(session)
command.each_char do |c|
session.send_key(c)
sleep(action_context.typi... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/model/action/command_action.rb | Ruby | mit | 46 | master | 471 | module Spielbash
class CommandAction < Spielbash::BaseAction
attr_accessor :command
def initialize(command, action_context)
super(action_context)
@command = command
end
def execute(session)
command.each_char do |c|
session.send_key(c)
sleep(action_context.typing_del... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/model/action/new_environment_action.rb | Ruby | mit | 46 | master | 557 | module Spielbash
class NewEnvironmentAction < Spielbash::BaseAction
attr_accessor :command, :wait_check_cmd
def initialize(command, wait_check_cmd, root_context)
super(root_context)
@command = command
@wait_check_cmd = wait_check_cmd
end
def execute(session)
command.each_char... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/model/action/message_action.rb | Ruby | mit | 46 | master | 514 | module Spielbash
class MessageAction < Spielbash::BaseAction
attr_accessor :message
def initialize(message, action_context)
super(action_context)
@message = message
end
def execute(session)
message.each_char do |c|
session.send_key(c)
sleep(action_context.typing_del... |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/model/action/pause_action.rb | Ruby | mit | 46 | master | 254 | module Spielbash
class PauseAction < Spielbash::BaseAction
attr_accessor :length
def initialize(length, action_context)
super(action_context)
@length = length
end
def execute(_session)
sleep(length)
end
end
end |
github | Malinskiy/spielbash | https://github.com/Malinskiy/spielbash | lib/spielbash/model/action/press_key_action.rb | Ruby | mit | 46 | master | 252 | module Spielbash
class PressKeyAction < Spielbash::BaseAction
attr_accessor :key
def initialize(key, action_context)
super(action_context)
@key = key
end
def execute(session)
session.send_key(key)
end
end
end |
github | jimmycuadra/jquery-tmpl-rails | https://github.com/jimmycuadra/jquery-tmpl-rails | jquery-tmpl-rails.gemspec | Ruby | mit | 46 | master | 830 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "jquery-tmpl-rails"
s.version = "1.1.0"
s.authors = ["Jimmy Cuadra"]
s.email = ["jimmy@jimmycuadra.com"]
s.homepage = ""
s.summary = %q{jQuery Templates for the Rails asset pipeline.}
s.description = %q{Adds the ... |
github | jimmycuadra/jquery-tmpl-rails | https://github.com/jimmycuadra/jquery-tmpl-rails | lib/jquery-tmpl-rails/jquery_template.rb | Ruby | mit | 46 | master | 858 | require 'sprockets'
require 'tilt'
require 'action_view'
require 'action_view/helpers'
module JqueryTmplRails
class JqueryTemplate < Tilt::Template
include ActionView::Helpers::JavaScriptHelper
def self.default_mime_type
'application/javascript'
end
def prepare
@prefix = normalize_prefi... |
github | jimmycuadra/jquery-tmpl-rails | https://github.com/jimmycuadra/jquery-tmpl-rails | lib/jquery-tmpl-rails/engine.rb | Ruby | mit | 46 | master | 412 | require "active_support/ordered_options"
module JqueryTmplRails
class Railtie < Rails::Engine
config.jquery_templates = ActiveSupport::OrderedOptions.new
config.jquery_templates.prefix = ""
initializer "sprockets.jquery_templates", :after => "sprockets.environment", :group => :all do |app|
next un... |
github | jimmycuadra/jquery-tmpl-rails | https://github.com/jimmycuadra/jquery-tmpl-rails | spec/spec_helper.rb | Ruby | mit | 46 | master | 265 | ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
Rails.backtrace_cleaner.remove_silencers!
require "capybara/rails"
require "capybara/rspec"
require "capybara/poltergeist"
Capybara.javascript_driver = :poltergeist |
github | jimmycuadra/jquery-tmpl-rails | https://github.com/jimmycuadra/jquery-tmpl-rails | spec/integration_spec.rb | Ruby | mit | 46 | master | 653 | require "spec_helper"
feature "Using jquery-tmpl-rails", js: true do
after do
Rails.application.config.jquery_templates.prefix = ''
end
scenario "Loading a page using a jQuery template" do
visit "/"
page.should have_content("Jimmy")
end
scenario "Using a template prefix", js: true do
Rails.... |
github | jimmycuadra/jquery-tmpl-rails | https://github.com/jimmycuadra/jquery-tmpl-rails | spec/jquery-tmpl-rails/jquery_template_spec.rb | Ruby | mit | 46 | master | 1,020 | require "spec_helper"
describe JqueryTmplRails::JqueryTemplate do
before { Rails.application.assets.cache = {} }
it "adds the jQuery Templates plugin to the load path" do
Rails.application.assets["jquery-tmpl"].should_not be_nil
end
it "compiles templates with the .tmpl extension" do
template = Rails... |
github | jimmycuadra/jquery-tmpl-rails | https://github.com/jimmycuadra/jquery-tmpl-rails | spec/dummy/config/application.rb | Ruby | mit | 46 | master | 2,469 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require
require "jquery-tmpl-rails"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initial... |
github | jimmycuadra/jquery-tmpl-rails | https://github.com/jimmycuadra/jquery-tmpl-rails | spec/dummy/config/initializers/secret_token.rb | Ruby | mit | 46 | master | 496 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... |
github | typekit/speakeasy | https://github.com/typekit/speakeasy | speakeasy.gemspec | Ruby | apache-2.0 | 46 | main | 4,295 | ## This is the rakegem gemspec template. Make sure you read and understand
## all of the comments. Some sections require modification, and others can
## be deleted if you don't need them. Once you understand the contents of
## this file, feel free to delete any comments that begin with two hash marks.
## You can find c... |
github | typekit/speakeasy | https://github.com/typekit/speakeasy | Rakefile | Ruby | apache-2.0 | 46 | main | 5,808 | require 'rubygems'
require 'rake'
require 'date'
#############################################################################
#
# Helper functions
#
#############################################################################
def name
@name ||= Dir['*.gemspec'].first.split('.').first
end
def version
line = Fil... |
github | typekit/speakeasy | https://github.com/typekit/speakeasy | lib/speakeasy/language.rb | Ruby | apache-2.0 | 46 | main | 2,903 | require 'yaml'
DATA_DIR = File.join(File.dirname(__FILE__), '..', '..', 'data')
module Speakeasy
class Language
# Public: Lists the supported IANA language codes.
#
# Returns an unordered array of all IANA language codes supported by the
# current version of this gem.
def self.supported_language... |
github | typekit/speakeasy | https://github.com/typekit/speakeasy | spec/language_spec.rb | Ruby | apache-2.0 | 46 | main | 1,329 | require File.dirname(__FILE__) + "/spec_helper"
describe "A Language" do
SupportedLanguages = 64
it "can list the supported language ids" do
expect(Speakeasy::Language.supported_language_ids.size).to eq(SupportedLanguages)
end
it "can get all supported languages" do
expect(Speakeasy::Language.all.siz... |
github | jichu4n/homebrew-palm-os | https://github.com/jichu4n/homebrew-palm-os | Formula/pilrc.rb | Ruby | apache-2.0 | 46 | master | 2,304 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Copyright (C) 2016 Chuan Ji <jichuan89@gmail.com> #
# #
... |
github | jichu4n/homebrew-palm-os | https://github.com/jichu4n/homebrew-palm-os | Formula/pilot-link.rb | Ruby | apache-2.0 | 46 | master | 3,932 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Copyright (C) 2016 Chuan Ji <jichuan89@gmail.com> #
# #
... |
github | jichu4n/homebrew-palm-os | https://github.com/jichu4n/homebrew-palm-os | Formula/prc-tools.rb | Ruby | apache-2.0 | 46 | master | 3,291 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Copyright (C) 2016 Chuan Ji <jichuan89@gmail.com> #
# #
... |
github | jichu4n/homebrew-palm-os | https://github.com/jichu4n/homebrew-palm-os | Formula/palm-os-sdk.rb | Ruby | apache-2.0 | 46 | master | 2,744 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Copyright (C) 2016 Chuan Ji <jichuan89@gmail.com> #
# #
... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | Rakefile | Ruby | mit | 46 | master | 442 | # frozen_string_literal: true
require 'bundler/gem_tasks'
require 'os'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'yard'
task default: OS.linux? ? %i[rubocop spec] : %i[spec]
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
end
RSpec::Core::RakeTask... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | elftools.gemspec | Ruby | mit | 46 | master | 1,255 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'elftools/version'
Gem::Specification.new do |s|
s.name = 'elftools'
s.version = ELFTools::VERSION
s.summary = 'ELFTools - Pure ruby library for parsing and patchi... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/elf_file_spec.rb | Ruby | mit | 46 | master | 6,814 | # encoding: ascii-8bit
# frozen_string_literal: true
require 'tempfile'
require 'elftools/elf_file'
describe ELFTools::ELFFile do
before(:all) do
@filepath = File.join(__dir__, 'files', 'amd64.elf')
@elf = described_class.new(File.open(@filepath))
end
it 'basic' do
expect(@elf.elf_class).to be 64
... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/util_spec.rb | Ruby | mit | 46 | master | 495 | # frozen_string_literal: true
require 'elftools/util'
describe ELFTools::Util do
it 'align' do
expect(ELFTools::Util.align(10, 1)).to be 10
expect(ELFTools::Util.align(10, 2)).to be 12
expect(ELFTools::Util.align(10, 3)).to be 16
expect(ELFTools::Util.align(10, 4)).to be 16
expect(ELFTools::Util... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/constants_spec.rb | Ruby | mit | 46 | master | 1,162 | # frozen_string_literal: true
require 'elftools/constants'
describe ELFTools::Constants do
it 'check scope' do
# Just make sure the methods in submodule didn't extend to Constants.
expect(ELFTools::Constants.respond_to?(:mapping)).to be false
end
it ELFTools::Constants::EM do
em = ELFTools::Constan... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/segments_spec.rb | Ruby | mit | 46 | master | 1,898 | # encoding: ascii-8bit
# frozen_string_literal: true
require 'elftools/segments/segments'
require 'elftools/structs'
describe ELFTools::Segments do
before(:all) do
@header_maker = lambda do |type: 0, flags: 0|
# endian is not important
phdr = ELFTools::Structs::ELF_Phdr[32].new(endian: :little)
... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/sections_spec.rb | Ruby | mit | 46 | master | 1,491 | # encoding: ascii-8bit
# frozen_string_literal: true
require 'elftools/sections/sections'
require 'elftools/structs'
describe ELFTools::Sections do
before(:all) do
@header_maker = lambda do |type: 0|
# endian is not important
shdr = ELFTools::Structs::ELF_Shdr.new(endian: :little)
shdr.assign(... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/dynamic_spec.rb | Ruby | mit | 46 | master | 1,692 | # frozen_string_literal: true
require 'elftools/elf_file'
describe ELFTools::Dynamic do
before(:all) do
filepath = File.join(__dir__, 'files', 'amd64.elf')
@elf = ELFTools::ELFFile.new(File.open(filepath))
end
describe 'dynamic segment' do
before(:all) do
@segment = @elf.segment_by_type(:dyna... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/spec_helper.rb | Ruby | mit | 46 | master | 426 | # frozen_string_literal: true
require 'simplecov'
require 'simplecov_json_formatter'
SimpleCov.start do
formatter SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::JSONFormatter,
SimpleCov::F... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/full_test/pie_spec.rb | Ruby | mit | 46 | master | 1,128 | # frozen_string_literal: true
require 'elftools'
describe 'Full test for PIE' do
before(:all) do
path = File.join(__dir__, '..', 'files', 'i386.pie.elf')
@elf = ELFTools::ELFFile.new(File.open(path))
end
it 'elf_file' do
expect(@elf.endian).to be :little
expect(@elf.elf_class).to be 32
expe... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/full_test/i386_spec.rb | Ruby | mit | 46 | master | 1,211 | # frozen_string_literal: true
require 'elftools'
describe 'Full test for i386' do
before(:all) do
path = File.join(__dir__, '..', 'files', 'i386.elf')
@elf = ELFTools::ELFFile.new(File.open(path))
end
it 'elf_file' do
expect(@elf.endian).to be :little
expect(@elf.elf_class).to be 32
expect(... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/full_test/so_spec.rb | Ruby | mit | 46 | master | 1,367 | # frozen_string_literal: true
require 'elftools'
describe 'Full test for shared object' do
before(:all) do
path = File.join(__dir__, '..', 'files', 'i386.so.elf')
@elf = ELFTools::ELFFile.new(File.open(path))
filepath = File.join(__dir__, '..', 'files', 'libc.so.6')
@libc = ELFTools::ELFFile.new(Fil... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/full_test/relro_spec.rb | Ruby | mit | 46 | master | 2,665 | # frozen_string_literal: true
require 'elftools'
describe 'Full test for relro types' do
before(:all) do
path = File.join(__dir__, '..', 'files', 'amd64.nrelro.elf')
@nrelro = ELFTools::ELFFile.new(File.open(path))
path = File.join(__dir__, '..', 'files', 'amd64.elf')
@partial = ELFTools::ELFFile.ne... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | spec/full_test/striped_spec.rb | Ruby | mit | 46 | master | 1,033 | # frozen_string_literal: true
require 'elftools'
describe 'Full test for striped binary' do
before(:all) do
path = File.join(__dir__, '..', 'files', 'amd64.strip.elf')
@elf = ELFTools::ELFFile.new(File.open(path))
end
it 'elf_file' do
expect(@elf.endian).to be :little
expect(@elf.elf_class).to ... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools.rb | Ruby | mit | 46 | master | 235 | # frozen_string_literal: true
require 'elftools/constants'
require 'elftools/elf_file'
require 'elftools/version'
# The ELF parsing tools!
# Main entry point is {ELFTools::ELFFile}, see it
# for more information.
module ELFTools
end |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/lazy_array.rb | Ruby | mit | 46 | master | 1,182 | # frozen_string_literal: true
require 'delegate'
module ELFTools
# A helper class for {ELFTools} easy to implement
# 'lazy loading' objects.
# Mainly used when loading sections, segments, and
# symbols.
class LazyArray < SimpleDelegator
# Instantiate a {LazyArray} object.
# @param [Integer] size
... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/elf_file.rb | Ruby | mit | 46 | master | 12,921 | # frozen_string_literal: true
require 'elftools/constants'
require 'elftools/exceptions'
require 'elftools/lazy_array'
require 'elftools/sections/sections'
require 'elftools/segments/segments'
require 'elftools/structs'
module ELFTools
# The main class for using elftools.
class ELFFile
attr_reader :stream # @... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/note.rb | Ruby | mit | 46 | master | 3,801 | # frozen_string_literal: true
require 'elftools/structs'
require 'elftools/util'
module ELFTools
# Since both note sections and note segments refer to notes, this module
# defines common methods for {ELFTools::Sections::NoteSection} and
# {ELFTools::Segments::NoteSegment}.
#
# @note
# This module can on... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/util.rb | Ruby | mit | 46 | master | 3,156 | # frozen_string_literal: true
module ELFTools
# Define some util methods.
module Util
# Class methods.
module ClassMethods
# Round up the number to be multiple of
# +2**bit+.
# @param [Integer] num Number to be rounded-up.
# @param [Integer] bit How many bit to be aligned.
# @... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/constants.rb | Ruby | mit | 46 | master | 41,062 | # frozen_string_literal: true
module ELFTools
# Define constants from elf.h.
# Mostly refer from https://github.com/torvalds/linux/blob/master/include/uapi/linux/elf.h
# and binutils/elfcpp/elfcpp.h.
module Constants
# ELF magic header
ELFMAG = "\x7FELF"
# Values of `d_un.d_val' in the DT_FLAGS an... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/dynamic.rb | Ruby | mit | 46 | master | 5,964 | # frozen_string_literal: true
module ELFTools
# Define common methods for dynamic sections and dynamic segments.
#
# @note
# This module can only be included by {ELFTools::Sections::DynamicSection}
# and {ELFTools::Segments::DynamicSegment} because methods here assume some
# attributes exist.
modul... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/structs.rb | Ruby | mit | 46 | master | 6,676 | # frozen_string_literal: true
require 'bindata'
module ELFTools
# Define ELF related structures in this module.
#
# Structures are fetched from https://github.com/torvalds/linux/blob/master/include/uapi/linux/elf.h.
# Use gem +bindata+ to have these structures support 32/64 bits and little/big endian simultan... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/exceptions.rb | Ruby | mit | 46 | master | 370 | # frozen_string_literal: true
module ELFTools
# Being raised when parsing error.
class ELFError < StandardError; end
# Raised on invalid ELF magic.
class ELFMagicError < ELFError; end
# Raised on invalid ELF class (EI_CLASS).
class ELFClassError < ELFError; end
# Raised on invalid ELF data encoding (E... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/segments/note_segment.rb | Ruby | mit | 46 | master | 548 | # frozen_string_literal: true
require 'elftools/note'
require 'elftools/segments/segment'
module ELFTools
module Segments
# Class of note segment.
class NoteSegment < Segment
# Load note related methods.
include ELFTools::Note
# Address offset of notes start.
# @return [Integer] The... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/segments/segment.rb | Ruby | mit | 46 | master | 1,602 | # frozen_string_literal: true
module ELFTools
module Segments
# Base class of segments.
class Segment
attr_reader :header # @return [ELFTools::Structs::ELF32_Phdr, ELFTools::Structs::ELF64_Phdr] Program header.
attr_reader :stream # @return [#pos=, #read] Streaming object.
# Instantiate a ... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/segments/interp_segment.rb | Ruby | mit | 46 | master | 492 | # frozen_string_literal: true
require 'elftools/segments/segment'
module ELFTools
module Segments
# For DT_INTERP segment, knows how to get path of
# ELF interpreter.
class InterpSegment < Segment
# Get the path of interpreter.
# @return [String] Path to the interpreter.
# @example
... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/segments/segments.rb | Ruby | mit | 46 | master | 1,217 | # frozen_string_literal: true
# Require this file to load all segment classes.
require 'elftools/segments/segment'
require 'elftools/segments/dynamic_segment'
require 'elftools/segments/interp_segment'
require 'elftools/segments/load_segment'
require 'elftools/segments/note_segment'
module ELFTools
# Module for d... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/segments/dynamic_segment.rb | Ruby | mit | 46 | master | 460 | # frozen_string_literal: true
require 'elftools/segments/segment'
require 'elftools/dynamic'
module ELFTools
module Segments
# Class for dynamic table segment.
#
# This class knows how to get the list of dynamic tags.
class DynamicSegment < Segment
include Dynamic # rock!
# Get the star... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/segments/load_segment.rb | Ruby | mit | 46 | master | 2,340 | # frozen_string_literal: true
require 'elftools/segments/segment'
module ELFTools
module Segments
# For DT_LOAD segment.
# Able to query between file offset and virtual memory address.
class LoadSegment < Segment
# Returns the start of this segment.
# @return [Integer]
# The file off... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/sections/section.rb | Ruby | mit | 46 | master | 1,695 | # frozen_string_literal: true
require 'elftools/constants'
module ELFTools
module Sections
# Base class of sections.
class Section
attr_reader :header # @return [ELFTools::Structs::ELF_Shdr] Section header.
attr_reader :stream # @return [#pos=, #read] Streaming object.
# Instantiate a {Sec... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/sections/null_section.rb | Ruby | mit | 46 | master | 383 | # frozen_string_literal: true
require 'elftools/sections/section'
module ELFTools
module Sections
# Class of null section.
# Null section is for specific the end
# of linked list (+sh_link+) between sections.
class NullSection < Section
# Is this a null section?
# @return [Boolean] Yes i... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/sections/sym_tab_section.rb | Ruby | mit | 46 | master | 4,234 | # frozen_string_literal: true
require 'elftools/sections/section'
module ELFTools
module Sections
# Class of symbol table section.
# Usually for section .symtab and .dynsym,
# which will refer to symbols in ELF file.
class SymTabSection < Section
# Instantiate a {SymTabSection} object.
#... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/sections/dynamic_section.rb | Ruby | mit | 46 | master | 515 | # frozen_string_literal: true
require 'elftools/dynamic'
require 'elftools/sections/section'
module ELFTools
module Sections
# Class for dynamic table section.
#
# This section should always be named .dynamic.
# This class knows how to get the list of dynamic tags.
class DynamicSection < Section... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/sections/sections.rb | Ruby | mit | 46 | master | 1,443 | # frozen_string_literal: true
# Require this file to load all sections classes.
require 'elftools/sections/section'
require 'elftools/sections/dynamic_section'
require 'elftools/sections/note_section'
require 'elftools/sections/null_section'
require 'elftools/sections/relocation_section'
require 'elftools/sections/s... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/sections/note_section.rb | Ruby | mit | 46 | master | 581 | # frozen_string_literal: true
require 'elftools/note'
require 'elftools/sections/section'
module ELFTools
module Sections
# Class of note section.
# Note section records notes
class NoteSection < Section
# Load note related methods.
include ELFTools::Note
# Address offset of notes sta... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/sections/str_tab_section.rb | Ruby | mit | 46 | master | 565 | # frozen_string_literal: true
require 'elftools/sections/section'
require 'elftools/util'
module ELFTools
module Sections
# Class of string table section.
# Usually for section .strtab and .dynstr,
# which record names.
class StrTabSection < Section
# Return the section or symbol name.
#... |
github | david942j/rbelftools | https://github.com/david942j/rbelftools | lib/elftools/sections/relocation_section.rb | Ruby | mit | 46 | master | 3,166 | # frozen_string_literal: true
require 'elftools/constants'
require 'elftools/sections/section'
require 'elftools/structs'
module ELFTools
module Sections
# Class of note section.
# Note section records notes
class RelocationSection < Section
# Is this relocation a RELA or REL type.
# @return... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | chatroid.gemspec | Ruby | mit | 46 | master | 942 | # coding: utf-8
require File.expand_path("../lib/chatroid/version", __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Ryo NAKAMURA"]
gem.email = ["r7kamura@gmail.com"]
gem.description = "Chatroid is a gem for quickly creating chatterbot in Ruby"
gem.summary = "Chatterbot builder"
... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | spec/chatroid_spec.rb | Ruby | mit | 46 | master | 1,472 | require "spec_helper"
describe Chatroid do
describe "#set" do
context "when given a hash" do
it "should set it to config" do
Chatroid.new { set :key => "val" }.config.should == { :key => "val" }
end
end
context "when given two args" do
it "should set it to config as key-value c... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | spec/chatroid/adapter_spec.rb | Ruby | mit | 46 | master | 567 | require "spec_helper"
describe Chatroid::Adapter do
describe ".find" do
context "when proper adapter class exists" do
before do
Chatroid::Adapter.stub(:const_get).and_return(adapter_class)
end
let(:adapter_class) do
Class.new
end
it "should return it" do
Ch... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | spec/chatroid/callback_spec.rb | Ruby | mit | 46 | master | 1,511 | require "spec_helper"
describe Chatroid::Callback do
let(:instance) do
mod = described_class
Class.new { include mod }.new
end
describe "#on_xxx" do
it "should store given block as callback" do
callback = proc {}
instance.on_xxx(&callback)
instance.list_xxx.should == [callback]
... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | spec/chatroid/adapter/campfire_spec.rb | Ruby | mit | 46 | master | 1,232 | require "spec_helper"
describe Chatroid::Adapter::Campfire do
before do
Tinder::Campfire.stub(:new).and_return(campfire)
campfire.stub(:find_room_by_id).and_return(room)
campfire.stub(:find_room_by_name).and_return(room)
end
let(:chatroid) do
Chatroid.new do
extend Chatroid::Adapter::Campf... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | spec/chatroid/adapter/xmpp_spec.rb | Ruby | mit | 46 | master | 1,391 | require "spec_helper"
describe Chatroid::Adapter::Xmpp do
let(:chatroid) do
Chatroid.new do
set :service, "Xmpp"
set :jid, "jid"
set :room, "room@example.com"
set :nick, "nick"
set :password, "password"
end
end
describe ".extended" do
context "when chatroid has jid" do
... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | spec/chatroid/adapter/twitter_spec.rb | Ruby | mit | 46 | master | 1,346 | require "spec_helper"
describe Chatroid::Adapter::Twitter do
let(:chatroid) do
Chatroid.new do
extend Chatroid::Adapter::Twitter
end
end
describe "#connect" do
it "should work in EventMachine::run" do
EventMachine.should_receive(:run) do |&block|
block.should be_a(Proc)
end... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | spec/chatroid/adapter/twitter/event_spec.rb | Ruby | mit | 46 | master | 2,135 | require "spec_helper"
describe Chatroid::Adapter::Twitter::Event do
describe "#type" do
subject do
Chatroid::Adapter::Twitter::Event.new(args.to_json, user_id).type
end
let(:args) do
{}
end
let(:user_id) do
1
end
let (:other_id) do
2
end
context "when f... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | examples/twitter_timer.rb | Ruby | mit | 46 | master | 466 | require "chatroid"
Chatroid.new do
set :service, "Twitter"
set :consumer_key, "..."
set :consumer_secret, "..."
set :access_key, "..."
set :access_secret, "..."
on_time :hour => 6, :min => 0, :sec => 0 do
tweet "Good morning!"
end
on_time :hour => 0, :min => 0, :sec => 0 do
... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | examples/twitter_public_stream.rb | Ruby | mit | 46 | master | 339 | require "chatroid"
Chatroid.new do
set :service, "Twitter"
set :filter, "chatroid,Chatroid"
set :consumer_key, "..."
set :consumer_secret, "..."
set :access_key, "..."
set :access_secret, "..."
on_tweet do |event|
favorite event
end
on_reply do |event|
favorite ev... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | examples/xmpp.rb | Ruby | mit | 46 | master | 306 | require "chatroid"
Chatroid.new do
set :service, "Xmpp"
set :room, "12345_example@conf.hipchat.com"
set :jid, "12345_67890@chat.hipchat.com"
set :nick, "example"
set :password, "..."
on_message do |time, nick, text|
say "Hi, #{nick}" if nick != config[:nick]
end
end.run! |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | examples/campfire.rb | Ruby | mit | 46 | master | 292 | require "chatroid"
Chatroid.new do
set :service, "Campfire"
set :subdomain, "example"
set :token, "..."
set :room_name, "Bots" # or `set :room_id, 12345`
on_message do |message|
speak "Hi #{message.user.name}" if message.user.name != user_info.name
end
end.run! |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | examples/irc.rb | Ruby | mit | 46 | master | 266 | require "chatroid"
Chatroid.new do
set :service, "Irc"
set :server, "example.com"
set :port, "6667"
set :channel, "#chatroid"
set :username, "chatroid"
on_privmsg do |message|
privmsg "#chatroid", ":" + "Hi, i am a chatroid"
end
end.run! |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | examples/twitter_user_stream.rb | Ruby | mit | 46 | master | 379 | require "chatroid"
Chatroid.new do
set :service, "Twitter"
set :consumer_key, "..."
set :consumer_secret, "..."
set :access_key, "..."
set :access_secret, "..."
on_tweet do |event|
if event["text"] =~ /chatroid/
favorite event
follow event
end
end
on_reply do |ev... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | lib/chatroid.rb | Ruby | mit | 46 | master | 1,229 | require "chatroid/version"
require "chatroid/callback"
require "chatroid/timer"
require "chatroid/adapter"
class Chatroid
include Callback
include Timer
def initialize(&block)
instance_eval(&block) if block_given?
end
def config
@config ||= {}
end
def run!
Thread.abort_on_exception = true
... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | lib/chatroid/timer.rb | Ruby | mit | 46 | master | 345 | require "chatroid/timer/event"
class Chatroid
module Timer
def on_time(every, &block)
events << Event.new(every, &block)
end
private
def start_timer
Thread.new do
loop do
events.each(&:call)
sleep 1
end
end
end
def events
@events ... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | lib/chatroid/callback.rb | Ruby | mit | 46 | master | 831 | class Chatroid
module Callback
# You can call methods like this:
# * list_message : return Array of callbacks for "message"
# * on_message : store a given block as callback for "message"
# * trigger_message : trigger callbacks for "message" with given args
def method_missing(method_name, *... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | lib/chatroid/adapter.rb | Ruby | mit | 46 | master | 278 | require "chatroid/adapter/campfire"
require "chatroid/adapter/irc"
require "chatroid/adapter/twitter"
require "chatroid/adapter/xmpp"
class Chatroid
module Adapter
def self.find(service_name)
const_get(service_name)
rescue NameError
nil
end
end
end |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | lib/chatroid/adapter/xmpp.rb | Ruby | mit | 46 | master | 2,606 | require "avalon"
require "xmpp4r"
require "xmpp4r/muc/helper/simplemucclient"
require "logger"
require "rexml/source"
# Support multybyte characters.
class REXML::IOSource
def read
@buffer << readline.force_encoding("utf-8")
rescue Exception, NameError
@source = nil
end
end
class Chatroid
module Adapt... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | lib/chatroid/adapter/campfire.rb | Ruby | mit | 46 | master | 1,140 | require "tinder"
class Chatroid
module Adapter
module Campfire
private
def connect
observe
end
def client
@client ||= Tinder::Campfire.new(
config[:subdomain],
:token => config[:token]
)
end
def room
@room ||=
if... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | lib/chatroid/adapter/irc.rb | Ruby | mit | 46 | master | 842 | require "zircon"
class Chatroid
module Adapter
module Irc
private
def connect
observe
client.run!
end
def client
@client ||= Zircon.new(
:server => config[:server],
:port => config[:port],
:channel => config[:channel],
... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | lib/chatroid/adapter/twitter.rb | Ruby | mit | 46 | master | 2,082 | require "chatroid/adapter/twitter/event"
require "twitter/json_stream"
require "twitter_oauth"
require "json"
require "cgi"
class Chatroid
module Adapter
module Twitter
private
def connect
EventMachine.run do
stream.on_error &method(:on_error)
stream.each_item &method(:on... |
github | r7kamura/chatroid | https://github.com/r7kamura/chatroid | lib/chatroid/adapter/twitter/event.rb | Ruby | mit | 46 | master | 1,288 | require "json"
class Chatroid
module Adapter
module Twitter
class Event
TYPES = %w[
favorite
unfavorite
follow
unfollow
list_member_added
list_member_removed
list_user_subscribed
list_user_unsubscribed
].freeze
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.