Skip to content

Instantly share code, notes, and snippets.

View yubessy's full-sized avatar

Shotaro Tanaka yubessy

View GitHub Profile
@yubessy
yubessy / README.md
Created January 15, 2017 03:13
Python logging using context

cxtlog

Contextual Logger for Python

Usage

>>> logging.basicConfig(level=logging.INFO)
>>> logger = logging.getLogger()
>>> cxtlgr = cxtlog.wrap(logger)
@yubessy
yubessy / mecab_wrapper.py
Created March 16, 2017 07:51
ごく適当なMeCabのPythonラッパー
import re
from collections import namedtuple
import MeCab
Node = namedtuple('Node', [
'surface',
'base',
'reading',
'pos',
@yubessy
yubessy / defaults-main.yml
Last active September 12, 2017 06:25
Ansible Python Role
---
python_version: 3.6.2
@yubessy
yubessy / defaults-main.yml
Last active September 12, 2017 06:29
Ansible pyenv role
---
pyenv_root: /opt/pyenv
pyenv_rcfiles: []
pyenv_versions: []
pyenv_global_version: system
pyenv_build_requirements:
# https://github.com/pyenv/pyenv/wiki/Common-build-problems
- zlib-devel
- bzip2
- bzip2-devel
@yubessy
yubessy / decrypt_morse.py
Last active June 1, 2018 03:00
decrypt_morse
MORSE_SIGNS = {
"a": ".-", "b": "-...", "c": "-.-.", "d": "-..", "e": ".", "f": "..-.",
"g": "--.", "h": "....", "i": "..", "j": ".---", "k": "-.-", "l": ".-..",
"m": "--", "n": "-.", "o": "---", "p": ".--.", "q": "--.-", "r": ".-.",
"s": "...", "t": "-", "u": "..-", "v": "...-", "w": ".--", "x": "-..-",
"y": "-.--", "z": "--..",
}
def decrypt_morse(morse):
@yubessy
yubessy / file0.txt
Last active April 13, 2019 03:38
Julia の SparseArrays で協調フィルタリング ref: https://qiita.com/yubessy/items/6e661b5ffb8b260cf51c
\hat{r}_{u,i} = \bar{r_u} + \frac{1}{|I_u|} \sum\limits_{i' \in I_u} \operatorname{sim}(i, i') (r_{u, i'} - \bar{r_u})