Skip to content

Instantly share code, notes, and snippets.

Hiroshiba Hiroshiba

  • Japan
View GitHub Profile
@Hiroshiba
Hiroshiba / check.bash
Created Nov 27, 2018
pythonの簡単なファイルロック
View check.bash
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
View .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 / file_snippet.sh
Created Oct 23, 2018
ファイル周りのスニペット
View file_snippet.sh
# findで見つけたファイルの最新-最古unixタイムを得るコマンド
echo `find [dir] [filter] -printf '%C@\n' | sort | awk 'NR==1; END{print}'` | awk '{print ($2 - $1)}'
View use_crepe.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Hiroshiba
Hiroshiba / rsync-xargs-pull.sh
Created Mar 31, 2018
rsync + xargs download
View rsync-xargs-pull.sh
rsync-xargs-pull () {
d=$2; d=${d%/*}
rsync --dry-run -av $1:$2 $3 | xargs -n128 -P1 -I@ rsync -avR $1:$d/./@ $3
}
@Hiroshiba
Hiroshiba / chainer_log_to_csv.py
Created Mar 6, 2018
chainerのjsonログファイルをcsv形式に変換する
View chainer_log_to_csv.py
"""
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 / fes_simulator.ipynb
Last active Jan 31, 2018
splatoonのフェスを想定したシミュレーション。 人数差が片方のチームに偏ると、人数が少ない方のチームが勝ちやすそうなことを検証した。
View fes_simulator.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Hiroshiba
Hiroshiba / numpy_file_validation.py
Last active Feb 17, 2018
numpy file validation
View numpy_file_validation.py
import argparse
import glob
import multiprocessing
import numpy
import tqdm
parser = argparse.ArgumentParser()
parser.add_argument('glob')
parser.add_argument('--processes', type=int)
@Hiroshiba
Hiroshiba / magic.sh
Last active Nov 15, 2017
fix matplotlib backend TkAgg error
View magic.sh
p=`python -c "import matplotlib; print(matplotlib.matplotlib_fname())"`
sed -i -e "s/backend\s*:\s*TkAgg/backend : Agg/g" $p
@Hiroshiba
Hiroshiba / convolution_1d.py
Created Nov 11, 2017
chainer's Convolution1D
View convolution_1d.py
import chainer
class Convolution1D(chainer.links.ConvolutionND):
def __init__(self, in_channels, out_channels, ksize, stride=1, pad=0,
nobias=False, initialW=None, initial_bias=None,
cover_all=False):
super(Convolution1D, self).__init__(
ndim=1,
in_channels=in_channels,
You can’t perform that action at this time.