Skip to content

Instantly share code, notes, and snippets.

View tuxedocat's full-sized avatar
🐈‍⬛
WFH with cats

yu-s tuxedocat

🐈‍⬛
WFH with cats
View GitHub Profile
from collections import defaultdict
def readfile(filepath):
"""
A function for reading .e2f, .f2e files
returns
-------
l: list
if .e2f, ["english word", "f word", "probability"]
# http://deeplearning.net/software/theano/tutorial/using_gpu.html
# -> just make it work with python3
from theano import function, config, shared, sandbox
import theano.tensor as T
import numpy
import time
vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
iters = 1000
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/bash
echo $(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 8 | grep -P "\w")
@tuxedocat
tuxedocat / README.md
Last active December 15, 2016 05:31
Pandocで日本語LuaLaTexを使う際に…

TeX Live 2014では…

Cygwinでは、 /usr/share/texmf-dist/tex/lualatex/pandocjsarticle/のように適当なところにクラスファイルを置いておく。 あと、mktexlsrを忘れずに。

pandoc -f markdown -t latex -V geometry:margin=1in -V documentclass=pandocjsarticle --latex-engine=lualatex -H h.tex input.md -o output.pdf

のように実行する。

TeX Live 2016では…

単純な書式のPandoc Markdownからなら、ltjsarticle がそのまま使えた。

@tuxedocat
tuxedocat / levd.py
Last active May 31, 2024 19:44
compute levenshtein distance
import numpy as np
from numba import jit
def levenshtein(x, y):
""" levenshtein distance for iterable sequences
"""
# check type
if (np.all(map(type, x)) is str) and (np.all(map(type, y)) is str):
_x = np.array(x, dtype=np.str)
@tuxedocat
tuxedocat / __init__.py
Last active April 12, 2016 09:03
Logging test
# coding: utf-8
import logging
import logging.config
import yaml
import os
def setup_logging(config_path='../config.yaml', default_level=logging.DEBUG):
"""Setup logging configuration
"""
@tuxedocat
tuxedocat / timeseries_plot_using_matplotlib.py
Last active April 19, 2016 06:31
Tiny little stupid showcase of how to plot multiple-group-timeseries as scatterplot, and click CLI library
# -*- coding: utf-8 -*-
"""visualizer: basic visualization module for debugging
"""
import pandas as pd
import matplotlib
import matplotlib.cm as cm
from matplotlib import pyplot as plt
from matplotlib import dates as mdates
import seaborn as sns
@tuxedocat
tuxedocat / .vimrc
Created April 28, 2016 01:48
vimrc
" Sane default settings for MSYS2 environment
" (which is too slow to use loads of nice plugins)
" 1. git clone https://github.com/w0ng/vim-hybrid
" and copy colors dir. to .vim/
" 2. git clone https://github.com/tpope/vim-sensible
" and copy plugin dir. to .vim/
set autoindent
set backspace=indent,eol,start
set complete-=i
@tuxedocat
tuxedocat / chkdiskusage.sh
Created April 28, 2016 08:09
diskusage chart
#!/bin/bash
du -ah --max-depth 3 \
| sort -rh \
| egrep "./(\w+/){2,3}" \
| sed "s@./@$(pwd)/@" > diskusage