Skip to content

Instantly share code, notes, and snippets.

View YamadaTakahito's full-sized avatar
🎯
Focusing

Yamada Takahito YamadaTakahito

🎯
Focusing
View GitHub Profile
@YamadaTakahito
YamadaTakahito / tokyo_geojson.json
Last active February 16, 2023 05:35
市区町村データ:国土交通省 国土数値情報(行政区域) https://nlftp.mlit.go.jp/ksj/ から東京都のみを取り出したもの
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@YamadaTakahito
YamadaTakahito / 0the_art_of_multiprocessor_programming.md
Last active June 6, 2020 08:01
The Art of Multiprocessor Programmingメモ
@YamadaTakahito
YamadaTakahito / video_util.py
Last active October 15, 2018 08:18
video util
import numpy as np
import imageio
class Video:
def __init__(self, path, mask_path):
reader = imageio.get_reader(path)
meta_data = reader.get_meta_data()
self.width, self.height = meta_data['size']
self.frame = meta_data['nframes']
self.fps = meta_data['fps']
@YamadaTakahito
YamadaTakahito / movie_to_gif.py
Last active July 30, 2018 06:08
mp4 movie to gif
import cv2
import numpy as np
from PIL import Image
def get_movie(path):
cap = cv2.VideoCapture(path)
imgs = []
while(True):
ret, frame = cap.read()
def conver_n_bit(img, n=1):
count = 2**n
extents = np.linspace(0, 255, num=count+1, dtype=int)
pixels = np.linspace(0, 255, num=count, dtype=int)
output = np.zeros(img.shape, dtype=int)
for i in range(count):
pixel = pixels[i]
bool_arr = (extents[i] <= img) & (img < extents[i+1])
output += bool_arr * pixel
def main():
rootfolder = Folder('root')
binfolder = Folder('bin')
rootfolder.add(binfolder)
binfolder.add(File('vi', 10000))
binfolder.add(File('latex', 20000))
rootfolder.accept(ListVistor())
from abc import ABCMeta, abstractmethod
def main():
try:
print('Making root entries')
rootfolder = Folder('root')
binfolder = Folder('bin')
tmpfolder = Folder('tmp')
usrfolder = Folder('usr')
from abc import ABCMeta, abstractmethod
def main():
try:
print('Making root entries')
rootfolder = Folder('root')
binfolder = Folder('bin')
tmpfolder = Folder('tmp')
usrfolder = Folder('usr')
class ListVistor(Vistor):
def __init__(self):
self.currentfolder = ''
def visit(self, file=None, folder=None):
if file is not None:
print('{}/{}'.format(self.currentfolder, file))
return
elif folder is not None:
print('{}/{}'.format(self.currentfolder, folder))