2021-03-15 kojix2
Github - https://github.com/kojix2/ruby-htslib
Slack - https://sciruby.slack.com
require 'benchmark_driver' | |
Benchmark.driver do |x| | |
x.prelude <<~RUBY | |
require 'numo/narray' | |
require 'prime' | |
class Integer | |
def devisors | |
[1].product(*prime_division.map { |p, n| (0..n).map { p**_1 } }).map { _1.inject(:*) }.sort |
# c2ffi: Clang-based FFI wrapper generator | |
# https://github.com/rpav/c2ffi | |
namespace :c2ffi do | |
desc 'Generate metadata files (JSON format) using c2ffi' | |
task :generate do | |
FileUtils.mkdir_p('codegen/c2ffilogs') | |
header_files = FileList['■■■/src/*.h'] | |
header_files.each do |file| | |
basename = File.basename(file, '.h') |
2021-03-15 kojix2
Github - https://github.com/kojix2/ruby-htslib
Slack - https://sciruby.slack.com
require 'ffi' | |
class S < FFI::Struct | |
layout :i, :int | |
end | |
a = S.new | |
a[:i] = 10 |
# frozen_string_literal: true | |
require "ffi" | |
module FFI | |
class BitStruct < Struct | |
class << self | |
# def union_layout(*args) | |
# Class.new(FFI::Union) { layout(*args) } | |
# end |
(Created by Google Translate)
2021-01-25 kojix2
Github: https://github.com/kojix2/ruby-htslib
Slack: https://sciruby.slack.com (Japanese)
2021-01-16 kojiox2
Github - https://github.com/kojix2/ruby-htslib
Slack - https://sciruby.slack.com
a |
require 'gr' | |
require 'gr3' | |
require 'numo/narray' | |
require 'optparse' | |
# コマンドラインオプション | |
options = { radius: 1.0, size: 500 } | |
OptionParser.new do |opt| | |
opt.on('-o', '--output PATH', String) { |v| options[:save_path] = v } | |
opt.on('-r', '--radius VALUE', Float) { |v| options[:radius] = v } |