View gist:3402572
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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 |
View gist:2779734
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
View LatestExcelFileFinder.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |