手元の仮想マシンにテスト用のmastodonインスタンスを立ててみるための手順メモ。 なおこの手順でできるのはテスト用インスタンスなので外に出さないように。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSTRLEN_MAX = 50 | |
N = 10000 | |
# user system total real | |
# ana1 0.109000 0.000000 0.109000 ( 0.104961) | |
# ana2 0.078000 0.000000 0.078000 ( 0.074173) | |
require 'benchmark' | |
def ana1(s1, s2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ARGV.size != 1 | |
warn "Usage: ruby #$0 <image file>" | |
exit | |
end | |
image_file = ARGV.shift.encode("utf-16le") | |
require "fiddle/import" | |
module Kernel32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
srcdir = File.expand_path("YOUR RUBY SOURCE DIRECTORY") | |
Dir.glob(File.join(srcdir, "gems", "*.gem")) do |gem| | |
tmp = File.basename(gem, ".gem").split(/-/) | |
version = tmp.pop | |
name = tmp.join('-') | |
spec = Gem::Specification.find{|s| s.name == name && s.version.version == version} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require "did_you_mean" | |
module Rake::TaskManager | |
def [](task_name, scopes=nil) | |
task_name = task_name.to_s | |
self.lookup(task_name, scopes) or | |
enhance_with_matching_rule(task_name) or | |
synthesize_file_task(task_name) or | |
(STDERR.puts "Don't know how to build task '#{task_name}' (see --tasks)"; | |
candidates = DidYouMean::SpellChecker.new(dictionary: @tasks.keys).correct(task_name); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/ruby | |
PS = "/bin/ps" | |
keys = ENV.keys.grep(/^process_\d+$/).sort_by{|e| e.split(/_/, 2).last.to_i} | |
arg = ARGV.shift | |
if arg == "autoconf" | |
if keys.empty? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "ripper" | |
def show(meth, arg) | |
case meth | |
when "dir_config" | |
puts "--with-#{arg}-dir" | |
when "enable_config" | |
puts "--enable-#{arg}" | |
when "with_config" | |
puts "--with-#{arg}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAZE = { | |
"0" => %w[1 6], | |
"1" => %w[0 7], | |
"2" => %w[3], | |
"3" => %w[2 4 9], | |
"4" => %w[3 5], | |
"5" => %w[4 B], | |
"6" => %w[0 C], | |
"7" => %w[1 8], | |
"8" => %w[7 9], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
C:\opt\ruby\bin\ruby.exe -x %~f0 %* | |
goto :EOF | |
#!ruby | |
require "yaml" | |
cache = File.join(File.dirname(__FILE__), "allruby.cache") | |
if File.exist?(cache) | |
rubies = YAML.load(File.read(cache)) | |
else |
Helixのファームウェアは左手側のボードにUSBケーブルを繋ぐことを前提に作られている。 が、右手側に繋ぎたいことだってあるじゃん? というわけで、どっちに繋いでも使えるようにしてみた。
まず、自分の使ってるファームウェアのディレクトリ内(例えばkeyboards/helix/rev2/keymaps/default)のkeymap.cの冒頭付近、
extern keymap_config_t keymap_config;
の直前くらいに、