This file contains hidden or 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
| argv <- commandArgs(TRUE) | |
| suppressPackageStartupMessages(library(quantmod)) | |
| # getSymbols("^TWII") | |
| # saveRDS(TWII, "TWII.Rds") | |
| TWII <- readRDS("TWII.Rds") | |
| print(TWII[argv[1]]) |
This file contains hidden or 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
| library(Rcpp) | |
| cppFunction(code=' | |
| void hello() { | |
| Rcout << "hello" << std::endl; | |
| }') | |
| hello() | |
| # 應該出現hello |
This file contains hidden or 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
| get_mat <- function(n) { | |
| retval <- diag(1, n) | |
| retval[lower.tri(retval)] <- 1 | |
| retval[,rev(1:n)] | |
| } |
This file contains hidden or 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
| img.fit100 { | |
| max-width:100%; | |
| max-height:100%; | |
| } | |
| /* copy from https://github.com/asimihsan/going_faster_with_python/blob/9dd25b5638ad73c0e2154024079379dc5f711d18/doc/presentation/slidify/assets/css/aicustom1.css */ | |
| /* | |
| @import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700,900,400italic,600italic,700italic,900italic&subset=latin,latin-ext); | |
| @import url(http://fonts.googleapis.com/css?family=Inconsolata:400,700&subset=latin,latin-ext); |
This file contains hidden or 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
| split.withleading <- function(x, a) { | |
| Map(function(i,j) x[i:j], a, cumsum(diff(c(a, length(x)+1)))) | |
| } |
This file contains hidden or 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
| gregexpr.extract_subpattern <- function(pattern, text, pattern.name) { | |
| r <- gregexpr(pattern, text, perl=TRUE) | |
| sapply(seq_along(r), function(i) { | |
| if (r[[i]] == -1) return("") | |
| a <- attributes(r[[i]]) | |
| stopifnot(isTRUE(all.equal(pattern.name, a$capture.names))) | |
| substring(text[i], a$capture.start, a$capture.start + a$capture.length - 1) | |
| }) | |
| } |
This file contains hidden or 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
| #include <Rcpp.h> | |
| using namespace Rcpp; | |
| //[[Rcpp::export]] | |
| SEXP vectorPlusScalar(NumericVector src) { | |
| int z = 1; | |
| return wrap(src + z); | |
| } |
This file contains hidden or 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
| library(pbdMPI) | |
| { # setting mpi environment | |
| .size <- comm.size() | |
| .rank <- comm.rank() | |
| # .hostname <- system("hostname", intern=TRUE) | |
| .hostname <- paste(.rank %% 2) | |
| hostname <- allgather(.hostname, unlist=TRUE) | |
| group <- split(seq_along(hostname) - 1, hostname) | |
| .group <- as.integer(which(names(group) == .hostname) - 1) | |
| .group.rank <- as.integer(which(group[[.hostname]] == .rank) - 1) |
This file contains hidden or 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
| source("b.R") | |
| hello() |
This file contains hidden or 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
| cat("asdkfja;sldfa;sl\n") |
OlderNewer