Skip to content

Instantly share code, notes, and snippets.

View ryuuji's full-sized avatar

Ryuuji Yoshimoto ryuuji

  • CALIL Inc.
  • Gifu, JP
View GitHub Profile
@ryuuji
ryuuji / stripPublisherID.sql
Created January 4, 2021 02:05
出版社記号を取り出す(Google BigQueryのDML)
# 出版社記号を取り出す
# ISBN-10を想定
CREATE TEMP FUNCTION
stripPublisherID(a STRING)
RETURNS STRING
LANGUAGE js AS """
if(!a.length==10)return null;
if(!a.startsWith('4'))return null;
let ln = 0;
@ryuuji
ryuuji / negima-index.py
Last active June 21, 2020 10:38
OPACのための汎用的なインデックスとスコアリング戦略 CC-0 / CALIL Inc / Ryuuji Yoshimoto
def create_index(es, index):
es.indices.create(index='negima-' + index, body={
"settings": {
"number_of_shards": 2,
"number_of_replicas": 0,
"refresh_interval": "30s",
"analysis": {
"analyzer": {
"wakachi": {
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import isbnlib
TRY_ISBN_DIRECT = ["direct"] # 直接
TRY_ISBN_10 = ["i10"] # ISBN10桁で検索
TRY_ISBN_13 = ["i13"] # ISBN13桁で検索
TRY_ISBN_13_10 = ["i13", "i10"] # ISBN10桁と13桁で検索
def initialize_camera(cap, role):
logger.info("カメラ[%s]を初期化しています" % role)
# 新しいV4K対応
cap.set(cv2.CAP_PROP_FPS, 15)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('M', 'J', 'P', 'G'))
for x in range(1,50):
# -*- coding: utf-8 -*-
# MIT
"""
参考スキーマ
mapping = {
"unitrad-doc": {
"properties": {
"source": {"type": "keyword"},
@ryuuji
ryuuji / summon.py
Last active January 25, 2019 04:40
Summonへのアクセス
import requests
from email.utils import formatdate
import hmac
import hashlib
import base64
import json
secret_key="xxxxxxxxx"
userid="xxxxxx"
keyword = "ryuuji+yoshimoto"
@ryuuji
ryuuji / restart.cmd
Created November 13, 2017 01:02
クロームの再起動
Taskkill /IM chrome.exe
timeout 1
start /max "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
@ryuuji
ryuuji / clip.py
Created November 13, 2017 00:59
デモ用のクリップボードツール
# coding: utf-8
import pyperclip as clip
import random
import time
keywords = """村上海賊の娘
村上春樹
1Q84
中津川市
@ryuuji
ryuuji / 0_reuse_code.js
Created March 21, 2014 11:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console