Skip to content

Instantly share code, notes, and snippets.

View NbtKmy's full-sized avatar
🏠
Working from home

Nobutake Kamiya NbtKmy

🏠
Working from home
View GitHub Profile
#!/usr/bin/env python3
import urllib.request
import json
import sys
from PIL import Image
import requests
from io import BytesIO
import cv2
import numpy as np
import img2pdf
#!/usr/bin/env python3
import os
from PIL import Image
if __name__ == "__main__":
im_list = []
for i in os.listdir('./img'):
filename = './img/' + i
imgs = Image.open(filename)
#!/usr/bin/env python3
import cv2
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Pre-process for OCR')
parser.add_argument('input', help='Name of original image')
parser.add_argument('output', help='Name of output image')
args = parser.parse_args()
#!/usr/bin/env python3
import urllib.request
import json
import sys
from PIL import Image
import requests
from io import BytesIO
import argparse
@NbtKmy
NbtKmy / test2_manifest.json
Last active February 26, 2021 10:27
test_manifest2
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "http://91d111ec-49ff-40c5-bd1e-fd3bdecee82d",
"@type": "sc:Manifest",
"label": "my favorit things",
"metadata": [],
"description": [
{
"@value": "... my favorit images",
"@language": "en"
@NbtKmy
NbtKmy / manifest.json
Created February 26, 2021 10:04
manifest_test
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "http://91d111ec-49ff-40c5-bd1e-fd3bdecee82d",
"@type": "sc:Manifest",
"label": "my favorit things",
"metadata": [],
"description": [
{
"@value": "... my favorit images",
"@language": "en"
@NbtKmy
NbtKmy / check_gnd.py
Last active January 20, 2021 00:28
Checking persons in the snf list with gnd api
import pandas as pd
import requests
df = pd.read_csv('snf_person.csv', sep=',')
df['viaf'] = 'NaN'
df['orcid_gnd'] = 'NaN'
df['gnd'] = 'NaN'
df['ambiguity'] = 0
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "http://93198e01-31fa-4953-a809-7cce9c2aa606",
"@type": "sc:Manifest",
"label": "test",
"metadata": [],
"description": [
{
"@value": "test",
"@language": "en"
@NbtKmy
NbtKmy / getBibliography_fromZotero.gs
Last active September 6, 2019 07:06
get bibliography from zotero
function getBibliografy() {
//最後のスライドを取得し、そのテキストボックスも取得
var presentationID = "your presentation-id";
var presentation = SlidesApp.openById(presentationID);
var slide = presentation.getSlides()[x]; //スライドx枚目
var shape = slide.getShapes();
var textBox = shape[0]; // 1番目のShape
var textRange = textBox.getText();
textRange.clear();
import json
def main():
f = open("/path/to/your.geojson", 'r')
json_data = json.load(f)
for i in range(len(json_data["features"])):
lat2 = json_data["features"][i]["properties"]["lat2"]
lon2 = json_data["features"][i]["properties"]["lon2"]