Skip to content

Instantly share code, notes, and snippets.

@Hiroshiba
Hiroshiba / chainer_log_to_csv.py
Created March 6, 2018 05:47
chainerのjsonログファイルをcsv形式に変換する
"""
python chainer_log_to_csv.py [input path] [output path]
"""
import argparse
import csv
import json
parser = argparse.ArgumentParser()
parser.add_argument('input')
@Hiroshiba
Hiroshiba / rsync-xargs-pull.sh
Created March 31, 2018 10:55
rsync + xargs download
rsync-xargs-pull () {
d=$2; d=${d%/*}
rsync --dry-run -av $1:$2 $3 | xargs -n128 -P1 -I@ rsync -avR $1:$d/./@ $3
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Hiroshiba
Hiroshiba / file_snippet.sh
Created October 23, 2018 11:17
ファイル周りのスニペット
# findで見つけたファイルの最新-最古unixタイムを得るコマンド
echo `find [dir] [filter] -printf '%C@\n' | sort | awk 'NR==1; END{print}'` | awk '{print ($2 - $1)}'
@Hiroshiba
Hiroshiba / .bash_profile
Created November 12, 2018 15:47
.bash_profile
function hh-audio-movie () {
ffmpeg -y -i $1 \
-filter_complex "[0:a]showwaves=mode=p2p:s=hd480:colors=Cyan[v]" \
-map "[v]" -map 0:a -pix_fmt yuv420p \
-b:a 360k $2
}
@Hiroshiba
Hiroshiba / check.bash
Created November 27, 2018 09:53
pythonの簡単なファイルロック
for i in `seq 0 4`; do python check.py & done
# [1] 83406
# [2] 83407
# [3] 83408
# [4] 83409
# [5] 83410
# start sleep 0
# finish sleep 0
# start sleep 1
@Hiroshiba
Hiroshiba / main.py
Created July 31, 2019 12:36
`timeout-decorator` with `threading` or `multiprocessing`
import multiprocessing
import threading
import time
import timeout_decorator
def countup():
for i in range(1, 10):
time.sleep(1)
@Hiroshiba
Hiroshiba / analyze.py
Created January 7, 2020 16:02
JVSデータセットの無音ラベルがどれくらい合ってるのか評価
from pathlib import Path
from typing import Union, Sequence
import librosa
import numpy
from librosa.effects import _signal_to_frame_nonsilent
from matplotlib import pyplot
from tqdm import tqdm
@Hiroshiba
Hiroshiba / analyze.py
Created January 11, 2020 16:14
JVSデータでの話者re-identifierの精度評価
from pathlib import Path
import numpy
from scipy.spatial.distance import cdist
def load_vector(path_format: Path):
predicted_vectors = []
true_speaker_nums = []
for speaker_num in range(100):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.