View testCPU.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
time echo "scale=5000; 4*a(1)" | bc -l -q |
View 黑白网页.html
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
<!-- 在网页的 head 部分加入以下内容,可以将网页改为黑白悼念模式 --> | |
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> | |
<style type="text/css"> | |
html { | |
filter: grayscale(100%); | |
-webkit-filter: grayscale(100%); | |
-moz-filter: grayscale(100%); | |
-ms-filter: grayscale(100%); | |
-o-filter: grayscale(100%); | |
filter: url(data:image/svg+xml;utf8,;#grayscale); |
View Sumatra.edt
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
// Sumatra? | |
FindInString(`%$('AcroRead')`,'SumatraPDF',1,2,1000,1); | |
IfOK(!"Relax;",!"JMP('not_sumatra')"); | |
Run('%$("AcroRead"); -reuse-instance -inverse-search "\"%B\WinEdt.exe\" \"[Open(|%%f|);SelPar(%%l,8);]\"" "%P\%N.pdf"','%P',0,0,'%N.pdf - SumatraPDF',1,1); | |
DDEOpen('',"SUMATRA","control",1); | |
// send a DDE command to perform forward-search | |
// the format of the DDE command is [ForwardSearch("<pdffilepath>","<sourcefilepath>",<line>,<column>[,<newwindow>, <setfocus>])] | |
// if newwindow = 1 then a new window is created even if the file is already open | |
// if focus = 1 then the focus is set to the window |
View updown_colors.R
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
updown_colors <- function(n = 50, down.col = 1/3, up.col=1, saturation = 1) | |
{ | |
c(hsv(down.col, saturation, seq(1,0,length=n)), hsv(up.col, saturation, seq(0,1,length=n))) | |
} |
View normal_test.R
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
# one sample normal test | |
norm_test1 <- function(x.n, x.mu, x.var, mu, side=0) | |
{ | |
nu <- x.n - 1 | |
z <- (x.mu - mu) / sqrt(x.var / x.n) | |
p <- p.value(pnorm, z, side=side) | |
data.frame(mean=x.mu, df=nu, statistic=z, p.value=p) | |
} | |
# two samples normal test |
View t_test.R
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
# one sample t-test | |
t_test1 <- function(x.n, x.mu, x.var, mu, side=0) | |
{ | |
nu <- x.n - 1 | |
t <- (x.mu - mu) / sqrt(x.var / x.n) | |
p <- p.value(pt, t, params=nu, side=side) | |
data.frame(mean=x.mu, df=nu, statistic=t, p.value=p) | |
} | |
# two samples t-test |
View p_value.R
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
p_value <- function(cdf, z, params=numeric(0), side=0) | |
{ | |
n <- length(params) | |
p <- switch(n+1, | |
cdf(z), | |
cdf(z, params), | |
cdf(z, params[1], params[2]), | |
cdf(z, params[1], params[2], params[3]) | |
) | |
if (side < 0) p |
View fold_change.R
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
fold_change <- function(x, y, confidence.level=90, var.equal=F) | |
{ | |
fc.interval(length(x), mean(x), var(x), length(y), mean(y), var(y), confidence.level, var.equal) | |
} | |
fc.interval <- function(x.n, x.mu, x.var, y.n, y.mu, y.var, confidence.level=90, var.equal=F) | |
{ | |
mu <- x.mu - y.mu | |
if (var.equal) { | |
nu <- x.n + y.n - 2 |
View robust_fold_change.R
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
robust_fold_change <- function(case, control) | |
{ | |
m <- dim(case)[2] | |
n <- dim(control)[2] | |
fc.raw <- matrix(nrow=dim(case)[1], ncol=m*n) | |
for (i in 1:m) { | |
for (j in 1:n) { | |
fc.raw[, (i-1)*m+j] <- case[,i] - control[,j] | |
} | |
} |
NewerOlder