Skip to content

Instantly share code, notes, and snippets.

Avatar
🍊
tachibana is a kind of citrus fruits and trees.

Hideyuki Tachibana tachi-hi

🍊
tachibana is a kind of citrus fruits and trees.
View GitHub Profile
@tachi-hi
tachi-hi / LatestExcelFileFinder.sh
Created May 18, 2012
A way to find the latest excel file
View LatestExcelFileFinder.sh
#!/usr/bin/bash
# >> ls *.xls
# xxx_v1.xls xxx_v10.xls xxx_v2.xls xxx_v3.xls
#
# we'd like to find the latest version.
ls *.xls | sed -e 's/.*_v\([0-9]*\).*/\1/g' | sort -n | tail -n 1
# or
@tachi-hi
tachi-hi / gist:2779734
Created May 24, 2012
Non-negative Matrix Factorization
View gist:2779734
# Given matrix V, and decompose it as
# V ~ W %*% H
NMF.EUC <- function(V, r, n){
W <- matrix(runif(nrow(V)*r), nrow(V), r)
H <- matrix(runif(ncol(V)*r), r, ncol(V))
d <- c(0)
for(i in 1:n){
W <- W * (V %*% t(H)) / (W %*% H %*% t(H))
H <- H * (t(W) %*% V) / (t(W) %*% W %*% H)
@tachi-hi
tachi-hi / gist:3402572
Created Aug 20, 2012
makefile for TeX (manual version management)
View gist:3402572
#
# makefile for TeX document whose version number is managed manually
# e.g.
# document_v1.tex document_v2.tex ...
#
LATEX = latex
BIBTEX = bibtex
DVIPDF = dvipdf
RM = rm -f