These are just an idea.
- Encode to a string
"UnVieQ=="
module ReadableFizzBuzz | |
module Chain | |
end | |
end | |
include ReadableFizzBuzz | |
Chain::Itself = Chain | |
module Chain::Itself |
require 'chunky_png' | |
require 'numo/narray' | |
file = ARGV[0] | |
data = File.binread(file) | |
wave = data[44..].unpack('v*').map do |v| | |
(v <= 0x7fff ? v : v - 0x10000).fdiv(0x8000) | |
end | |
RATE = 44100 | |
sec = ARGV[1].to_i.nonzero? || 5 |
mut = Ractor.new do | |
pipe = Ractor.new do | |
loop { Ractor.yield Ractor.receive } | |
end | |
loop do | |
Ractor.yield pipe | |
pipe.take | |
end | |
end |
require 'prism' | |
require 'ripper' | |
def parsey_extract_locations(code) | |
lines = code.lines | |
line_indexes = lines.reduce([0]) { _1 << _1.last + _2.bytesize } | |
code_index = ->(line, col) { line_indexes[line - 1] + col } | |
locations = [] | |
each_node = -> node do | |
locs = node.locations.compact |
all_tokens = %w[ | |
x | |
y | |
false | |
if | |
rescue | |
begin | |
end | |
= | |
def |
require 'irb' | |
require 'stringio' | |
def count_lines(ascii_text, width) | |
ascii_text.lines.sum{|l| [(l.chomp.size-1)/40+1,1].max } | |
end | |
10000.times do |i| | |
width = 40 | |
height= 20 | |
out = IRB::Pager::PageOverflowIO.new(width, height, ->*{}) |
require 'prism' | |
Dir.glob('../**/*.rb').each do |file| | |
next if file =~ /(^|\/)tmp\// | |
codes = [] | |
prc = ->(node) { | |
codes << node.slice | |
codes << node.unescaped if node.is_a? Prism::StringNode | |
node.compact_child_nodes.each { prc.call it } | |
} |
require 'socket' | |
require 'json' | |
endpoint = ARGV[0] | |
src = ARGV[1] | |
dst = ARGV[2] || '' | |
unless endpoint =~ /\A.+:\d+\z/ && src | |
puts "ARGV[0]: host:port" | |
puts "ARGV[1]: src dir" | |
puts "ARGV[2]: dst dir" |
puts <<RUBY.b | |
eval eval eval eval eval <<'CODE' | |
$>.set_encoding 'utf-8' | |
$><<"#{'あ'.b}" | |
<<'A' | |
# encoding: euc-jp | |
$><<"#{'い'.encode('euc-jp').b}" | |
<<'B' | |
# encoding: sjis | |
$><<"#{'う'.encode('sjis').b}" |