Skip to content

Instantly share code, notes, and snippets.

View klainfo's full-sized avatar

Chakkrit (Kla) Tantithamthavorn klainfo

View GitHub Profile
# C++ functions parser
# Reference: http://stackoverflow.com/questions/6133989/what-grep-command-will-include-the-current-function-name-in-its-output
# Usage: ./cpp-parser.sh <file.cpp>
awk -v re='return' '/^[[:alpha:]]/{f=FNR"-"$0} $0~re{printf "%s\n%d:%s\n--\n",f,FNR,$0; f="" }' $1
@klainfo
klainfo / render_post.R
Last active August 29, 2015 14:25
Put in the Rmd directory and run ./render_post.R <file.Rmd>
#!/usr/bin/env Rscript
# Reference: http://jfisher-usgs.github.io/r/2012/07/03/knitr-jekyll/
input <- commandArgs(trailingOnly = TRUE)
KnitPost <- function(input, base.url = "/") {
require(knitr)
opts_knit$set(base.url = base.url)
fig.path <- paste0("../figs/", sub(".Rmd$", "", basename(input)), "/")
opts_chunk$set(fig.path = fig.path)
@klainfo
klainfo / loadCaretDependency.R
Created July 23, 2015 18:14
load all caret dependency R packages
install.packages("caret", dependencies = c("Depends", "Suggests"))
@klainfo
klainfo / cpusAvailable.R
Created July 25, 2015 18:51
How many cpus are available for parallel jobs?
library(parallel)
cores <- detectCores()
load <- read.table("/proc/loadavg",sep=" ")$V1
cores*.8 - load
@klainfo
klainfo / installBoost.sh
Last active August 29, 2015 14:26
How to use wsrf with Boost Parallel Computing library
# Download Boost C++ library
wget http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.gz/download
# Extract
tar -zxvf download
# Install http://wiki.tiker.net/BoostInstallationHowto
cd boost_1_58_0
./bootstrap.sh --prefix=/home/hpc3151/pool --libdir=/home/hpc3151/pool/lib --with-libraries=signals,thread,python,mpi
./bjam -j4 variant=release link=shared install
td <- expand.grid(
hjust=c(0, 0.5, 1),
vjust=c(0, 0.5, 1),
angle=c(0, 45, 90),
text="text"
)
ggplot(td, aes(x=hjust, y=vjust)) +
geom_point() +
geom_text(aes(label=text, angle=angle, hjust=hjust, vjust=vjust)) +
@klainfo
klainfo / out-of-sample-bootstrap.R
Created June 25, 2016 23:40
An Example Code for the Out-of-sample Bootstrap
library(DefectData)
library(pROC)
Data <- loadData("eclipse-2.0")
data <- Data$data
dep <- Data$dep
indep <- Data$indep
# Normality Correction
transformLog <- function(y){ y <- log1p(y)}
data[,indep] <- data.frame(apply(data[,indep], 2, transformLog))
ASSISTANT PROFESSOR IN SOFTWARE ENGINEERING AT McGILL UNIVERSITY
================================================================
The School of Computer Science at McGill University invites applications
for a tenure-track appointment in software engineering at the rank of
assistant professor, to begin on August 1st, 2017.
Candidates should have or soon expect a Ph.D. in Computer Science or
related field, have a strong publication record in software engineering,
and have experience with the development and/or analysis of large-scale
The Department of Computer Science in the Faculty of Science at Ryerson University (http://www.scs.ryerson.ca) invites applications for a full-time tenure-track position in Software Engineering at the Assistant Professor level. The applicant is expected to contribute to research and teaching in the area of Software Engineering. Exceptional candidates in other areas of Computer Science may also be considered. This position commences July 1, 2017, subject to final budgetary approval.
Candidates will hold a PhD in Computer Science or a related field. Candidates shall hold a strong research profile (e.g., evidence of an emerging scholarly record), and show evidence of high-quality teaching and student training. The successful candidate will be expected to establish and maintain an independent, externally funded research program, supervise graduate students, teach Computer Science courses at all levels, and engage in collegial service.
The Department of Computer Science, consisting of 20 tenure-stream faculty me
Open positions: Assistant Professors in Computer Science
Department of Computer Science, Faculty of Engineering
University of Victoria
The Department of Computer Science in the Faculty of Engineering at
the University of Victoria is seeking applications for up to four
tenure track faculty positions at the assistant professor level with
an expected start date of July 1, 2017.
We seek individuals with demonstrated potential to build an