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
# 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
#!/bin/bash
echo $(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 8 | grep -P "\w")
from collections import defaultdict
def readfile(filepath):
"""
A function for reading .e2f, .f2e files
returns
-------
l: list
if .e2f, ["english word", "f word", "probability"]
@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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
@tuxedocat
tuxedocat / build-docx.sh
Created May 11, 2016 06:05
pandoc markdown to xxx
#!/bin/bash
pandoc -f markdown_github+tex_math_dollars+pandoc_title_block+ignore_line_breaks -t docx -o $1.docx $1
@tuxedocat
tuxedocat / count-inodes.sh
Created June 9, 2016 00:20
Counts num. of inodes in given directory, writes (n_inodes path) as report, and shows total num. of inode usage.
#!/bin/bash
find $1 -xdev -printf '%h\n' |
sort |
uniq -c |
sort -k 1 -n -r |
tee inodeusage |
tr -s " " |
cut -f 2 -d " " |
python -c"import sys; print(sum(map(int, sys.stdin)))"