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
def make_jump_table(prog) | |
pc = 0 | |
jump_table = {} | |
stack = [] | |
while pc < prog.size | |
case prog[pc] | |
when ?[ | |
stack.push pc | |
when ?] | |
raise '対応する[がない' if stack.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
const puppeteer = require('puppeteer'); | |
const fs = require("fs"); | |
const url = "https://techbookfest.org/event/tbf07/circle/xxxxxxxxxxxxxxx"; | |
(async () => { | |
const browser = await puppeteer.launch({ headless: false }); | |
const page = await browser.newPage(); |
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 "psych" | |
require "redcarpet" | |
require_relative "./renderer" | |
require_relative "./toc_renderer" | |
module Mwr | |
class Generator | |
def initialize(workdir) | |
@workdir = File.expand_path(workdir) |
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
text = File.read "./utamap.test.txt" | |
vocabraries = [] | |
word2id = {} | |
text.split("\n").each do |doc| | |
words = doc.split(" ") | |
words.each do |word| | |
unless word2id.has_key?(word) | |
vocabraries << word |
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_relative "./renderer" | |
require "psych" | |
markdown = Redcarpet::Markdown.new(Renderer, autolink: true, tables: true) | |
files = Psych.load_file("articles/articles.yaml") | |
File.open("html/index.html", "w") do |html| | |
html.write <<~HTML | |
<html> |
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
s=30;g=[0]*(s+2)**2;[100,133,163,164,165].each{g[_1]=1};100.times{s.times{|y|puts s.times.map{g[_1+s+3+y*(s+2)]==1??*:?.}.join};(s*s).times.map{|i| i+=i/s*2;[0,1,2,3,5,6,7,8].map{g[i+_1%3+_1/3*2+_1/3*s]}.sum.then{_1==3?1:_1==2?g[i+s+3]:0}}.tap{|n|(s*s).times{g[_1+s+3+_1/s*2]=n[_1]}};sleep(0.1);print"\e[#{s}A"} |
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
bin = "YARB\u0002\u0000\u0000\u0000\u0005\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000x86_64-darwin16\u0000" | |
putself = 16 | |
putstring = 20 | |
opt_send_without_block = 52 | |
leave = 55 | |
hello = 3 | |
codes = [ |
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 "sparql/client" | |
class Dataset | |
include Enumerable | |
def initialize | |
@sparql = SPARQL::Client.new("http://ja.dbpedia.org/sparql") | |
end | |
def each |
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 "datasets" | |
class Array | |
def avg(&block) | |
return 0.0 if self.length == 0 | |
self.sum(&block) / self.length | |
end | |
end | |
class Node |
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
class CkySolver | |
def initialize(&init_proc) | |
@init_proc = init_proc | |
end | |
def solve(n, &callback) | |
a = Array.new(n * n) | |
n.times {|i| a[i*n + i] = @init_proc.call(i) } | |
(n - 1).times do |d| |
NewerOlder