Skip to content

Instantly share code, notes, and snippets.

View koreyou's full-sized avatar

Yuta Koreeda koreyou

View GitHub Profile
@koreyou
koreyou / shuf
Created January 6, 2018 09:31
Linux shuf command with seed option
#!/bin/bash
# seeding adopted from https://stackoverflow.com/a/41962458/7820599
get_seeded_random()
{
seed="$1";
openssl enc -aes-256-ctr -pass pass:"$seed" -nosalt \
</dev/zero 2>/dev/null;
}
@koreyou
koreyou / startup.py
Created January 7, 2018 07:58
ipython startup (deprecated)
# coding: utf-8
"""
This is the ipython startup script that I used to use in university.
(but not anymore)
Place it in ~/.ipython/profile_default/startup/startup.py for it to work
"""
import numpy as np
import math
import matplotlib.pyplot as plt
import matplotlib
@koreyou
koreyou / .gitconfig
Created March 21, 2018 12:41
My git configuration
[user]
email = koreyou@mac.com
name = Yuta Koreeda
[core]
editor = emacs -nw
[alias]
# Adopted from https://www.jacobtomlinson.co.uk/quick%20tip/2016/01/18/pretty-git-logs-with-git-lg/
lg = !"git lg1"
@koreyou
koreyou / find_chainer_usage.py
Last active May 29, 2018 11:33
Find usage of deep learning library "Chainer" within Github repositories
import requests
import re
import time
"""
Prerequisite: Create access tokens
You need private access token to have full access to Github search
API.
Generate your access token in [here](https://github.com/settings/tokens)
@koreyou
koreyou / bm25.py
Created November 1, 2019 05:26
Implementation of OKapi BM25 with sklearn's TfidfVectorizer
""" Implementation of OKapi BM25 with sklearn's TfidfVectorizer
Distributed as CC-0 (https://creativecommons.org/publicdomain/zero/1.0/)
"""
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from scipy import sparse
class BM25(object):