Skip to content

Instantly share code, notes, and snippets.

@arc279
arc279 / a.py
Created May 18, 2017 06:41
hog特徴量を抽出して描画
import cv2
import matplotlib.pyplot as plt
from skimage.feature import hog
from skimage import color, exposure
img = cv2.imread('test2.png')
image = color.rgb2gray(img)
fd, hog_image = hog(image, orientations=9, pixels_per_cell=(8, 8),
@arc279
arc279 / a.sh
Created May 22, 2017 05:30
awkでdatetime比較
cat a.tsv | awk -F$'\t' '"2017-05-13 07:50" <= $4 && $4 <= "2017-05-18 01:58"' | sort -k4
@arc279
arc279 / a.sh
Created May 23, 2017 10:45
source されたか判別
if [ "$0" = "$BASH_SOURCE" ]; then
echo "subshell!!"
else
echo "sourced!!"
fi
@arc279
arc279 / a.sh
Created May 25, 2017 07:53
1週間おき
#!/bin/bash
D=$(date +'%Y-%m-%d')
for x in $(seq 1 100); do
echo $D
D=$(date +'%Y-%m-%d' --date "$D 7 day")
done
@arc279
arc279 / a.sh
Created May 31, 2017 10:06
mac でbootable usb作成
#!/bin/bash
# for mac
: diskutil list
DISK=/dev/disk2
ISO=CentOS-7-x86_64-Minimal-1611.iso
: diskutil eraseDisk MS-DOS UNTITLED $DISK
: diskutil unmountDisk $DISK
@arc279
arc279 / a.py
Last active June 15, 2017 11:39
常駐型で処理する
#!/usr/bin/env python
import os
import io
import click
import pandas as pd
from bottle import Bottle, request
@arc279
arc279 / a.sh
Created June 16, 2017 08:11
stdinをteeで分割した後の処理の出力を統合する
#!/bin/bash
rm -f fifo
mkfifo fifo
cat fifo | sort > out &
cat <<EOD | tee >(cut -f1 >fifo) >(cut -f2 >fifo) >(cut -f3 >fifo) >(cut -f4 >fifo) >/dev/null
aaa 111 444 777
bbb 222 555 888
g google.com
@arc279
arc279 / a.py
Last active June 23, 2017 06:59
pickleに追記と読み出し
import pickle
def dump_seq(r, of):
with open(of, "wb") as f:
pickle.dump(next(r), f)
try:
while True:
with open(of, "ab") as f:
pickle.dump(next(r), f)
[WARN] A plugin uses a deprecated constructor of org.embulk.spi.time.TimestampFormatter.
[WARN] Please tell the plugin developer to stop using the constructor, or report this to:
[WARN] https://github.com/embulk/embulk/issues/745
[WARN] java.lang.Thread.getStackTrace(Thread.java:1559)
[WARN] org.embulk.spi.time.TimestampParser.<init>(TimestampParser.java:116)
[WARN] org.embulk.filter.column.ColumnVisitorImpl.getDefault(ColumnVisitorImpl.java:154)
[WARN] org.embulk.filter.column.ColumnVisitorImpl.getDefault(ColumnVisitorImpl.java:115)
[WARN] org.embulk.filter.column.ColumnVisitorImpl.buildOutputDefaultMap(ColumnVisitorImpl.java:92)
[WARN] org.embulk.filter.column.ColumnVisitorImpl.<init>(ColumnVisitorImpl.java:56)
[WARN] org.embulk.filter.column.ColumnFilterPlugin$1.<init>(ColumnFilterPlugin.java:224)