Skip to content

Instantly share code, notes, and snippets.

View amane-katagiri's full-sized avatar

Amane Katagiri amane-katagiri

View GitHub Profile
@amane-katagiri
amane-katagiri / SlackHandler.py
Last active March 15, 2017 03:39
Slack handler for the logging package for Python.
"""Slack handler for the logging package for Python."""
import json
from logging import DEBUG
from logging import Formatter
from logging import getLogger
from logging.handlers import HTTPHandler
class SlackHandler(HTTPHandler):

Keybase proof

I hereby claim:

  • I am amane-katagiri on github.
  • I am amane (https://keybase.io/amane) on keybase.
  • I have a public key whose fingerprint is 75CB B604 4ABF 0EA0 C15C 38E8 5642 D37E E532 097E

To claim this, I am signing this object:

@amane-katagiri
amane-katagiri / lgtm.sh
Created June 5, 2017 07:08
LGTM movie maker
ffmpeg -i input.mp4 -filter_complex "drawtext=fontfile=/usr/share/fonts/truetype/mplus/mplus-1p-bold.ttf:text=LGTM:x=(w-text_w)/2:y=(h-text_h-line_h)/2:fontcolor=white:fontsize=200" output.mp4
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
r"""
Generate emoji list json file for mdx_unimoji(https://github.com/kernc/mdx_unimoji).
You can convert emoji_strategy.json on emojione (https://github.com/emojione/emojione) into
`{"ENTITY1": ["NAME1"], "ENTITY2": ["NAME2", "ALTERNAME2", ...], ...}`.
Usage:
$ ./emoji_generator.py https://raw.githubusercontent.com/Ranks/emojione/master/emoji_strategy.json
@amane-katagiri
amane-katagiri / cmake.sh
Last active August 9, 2017 13:15
Cmake flags for opencv and python3
mkdir release
cd release
cmake -DCMAKE_BUILD_TYPE=RELEASE -DWITH_TBB=YES -DWITH_EIGEN=YES -DBUILD_NEW_PYTHON_SUPPORT=ON -DBUILD_opencv_python3=ON \
-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-DCMAKE_INSTALL_PREFIX=~/usr/software/opencv_build \
-DPYTHON_EXECUTABLE=~/.pyenv/versions/mlc/bin/python3 \
-DPYTHON_LIBRARY=~/.pyenv/versions/3.5-dev/lib/libpython3.so ..
make -j8
make install
@amane-katagiri
amane-katagiri / run.sh
Last active August 9, 2017 13:17
foregroundize script (useful in docker)
#!/bin/sh
trap 'echo "reload command"' HUP
trap 'echo "stop command"' EXIT
trap 'echo "stop command"; trap EXIT; exit 0' TERM INT
echo "start command which launches a background service and returns immediately"
while true; do sleep 3600 & wait; done
@amane-katagiri
amane-katagiri / ahaha.py
Last active August 9, 2017 13:18
"あは ぎょうざ あはは" one-liner.
print(" ".join(["あはは" + "は" * __import__("random").randint(0, 3) for x in range(int(abs(__import__("random").normalvariate(0, 2)) * 10 + 1))]), "あは ぎょうざ あはは")
@amane-katagiri
amane-katagiri / twdel.py
Created September 5, 2017 16:12
Delete tweets.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from requests_oauthlib import OAuth1Session
CK = "CONSUMER_KEY"
CS = "CONSUMER_SECRET"
AT = "ACCESS_TOKEN"
AS = "ACCESS_SECRET"
This file has been truncated, but you can view the full file.
@ 単価…で/…につき
104 通信で用いられる『了解』の意を表す語
A answer / ampere
a. about / acre[s] / adjective
Triassic period (地質の年代で)三畳紀の / 二畳紀
A,a 〈C〉英語アルファベットの第1字 / 〈U〉(音階の)イ音,イ調 / 〈C〉《米》(学校の成績の)A
A.A. =AA / antiaircraft
a,an 《oneの弱い意味で》『一つの』,一人の / 《日本語では表現しない場合》 / 《日本語でも表現する場合》 / 『ある』(a certain) / 《同種類のものを代表してany, eachの弱い意味で》…『というもの[は]』,いずれの,どの / 《単位を表す語につけて》…『につき』,毎…(per) / 《しばしばof, atなどの後で》同じ(the same) / 《固有名詞につけて》…のような人,…という名の人,…家の人;…の作品(製品) / 《固有名詞の性格・特徴などを強調するとき》 / 《andで結んだ二つ以上の名詞につけて》 / 《名詞が同一の人・物をさす場合》…でも~でもある人(物) / 《名詞が別個の人・物をさす場合》…つきの,一組の…と~ / 《物質名詞につけて》一種の,一つの / 《抽象名詞につけその具体例・種類・行為などを表して》 / 《have,give,make,takeなどに続く動詞と同形の名詞につけて》1回の
A.B. B.A.
A.C. ante Christum 紀元前(before Christ)
@amane-katagiri
amane-katagiri / bash_trap_template.sh
Created September 26, 2017 09:33 — forked from sechiro/bash_trap_template.sh
Bash signal trap template. Bashでよく使うシグナルトラップのテンプレート。
#!/bin/bash
set -u # Check unset variables only
#set -ue # Check unset variables. Exit on error
LANG=C
# Trap signals
trap_HUP() {
echo "Trap HUP signal."
exit 1
}