Skip to content

Instantly share code, notes, and snippets.

@masao
masao / sukilam-search.html
Created November 23, 2023 17:20
JP-COS + S×UKILAM連携
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" crossorigin="anonymous"></script>
<script type="application/javascript">
function sem_search() {
let cos = document.getElementById("cos");
#!/usr/bin/env ruby
require "pp"
require "roo"
if ARGV.size < 2
puts "USAGE: #$0 competence.xlsx SIR201911xxx.xlsx"
exit
end
subject_mappings = {
#!/usr/bin/env ruby
require "benchmark"
require "rubygems"
if ARGV.size < 1
puts <<-EOF
USAGE:
#$0 "~> 3.2.0"
or
layout title tags comments
post
Call For Proposals - Code4Lib JAPAN Conference 2022

日本語版はこちら

This year's Code4Lib JAPAN Conference will be held online over two days, Saturday, September 3rd and Sunday, September 4th, 2022, following last year's conference. We invite presentations on a variety of initiatives, including software applications in libraries, archives, and museums, and new ideas related to use of community-based library resources and technologies.

#!/usr/bin/env ruby
require "open-uri"
require "csv"
require "nokogiri"
CSV.foreach(ARGV[0], { headers: true, col_sep: "\t" }) do |row|
iss_url = row["manifestation_identifier"]
manifestation_id = row["manifestation_id"]
creators = []
#!/usr/bin/env rubyt
require "roo"
@codes = {}
xlsx = Roo::Excelx.new(ARGV[0], {headers: true})
xlsx.default_sheet = "all_数字はAに"
xlsx.each_row_streaming(pad_cells: true, headers: true, offset: 4) do |row|
#p row
#p row[7]
require_relative "ext-hlv.rb"
ARGF.each do |line|
bibid, hlv, = line.chomp.split(/\t/)
hlv.expand_hlv.each do |vol|
puts [bibid, vol].join("\t")
end
end
@masao
masao / ext-hlv.rb
Last active December 20, 2020 08:52
所蔵式 HLV の巻情報を展開する
class String
def expand_hlv
self.gsub(/\([^\)]+\)/, "").split(/;/).map do |e1|
e1.split(/,\s*/).map do |e|
start_vol, end_vol, = e.gsub(/\+/, "").split(/-/)
if end_vol
(start_vol .. end_vol).to_a
else
start_vol
end
@masao
masao / iss-identifyer.rb
Last active November 9, 2020 14:19
iss-identifyer.rb
#!/usr/bin/env ruby
require "uri"
require "open-uri"
require "nokogiri"
NS = {
dcndl: "http://ndl.go.jp/dcndl/terms/",
dcterms: "http://purl.org/dc/terms/",
foaf: "http://xmlns.com/foaf/0.1/",
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<textarea id="list" rows="15" cols="30" style="width:100%"></textarea><br>
<button onclick="javascript:convert();">