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/env bash | |
if [[ -f "/etc/lsb-release" ]]; then | |
apt-get --version | |
sudo apt-get -y update | |
sudo apt-get -y install gcc make | |
elif [[ -f "/etc/redhat-release" ]]; then | |
if `dnf --version`; then | |
sudo dnf -y update | |
sudo dnf -y install gcc make |
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
sudo yum -y install ppp pptp pptp-setup | |
sudo pptpsetup --create "vpn" --server "vpn.example.jp" --username "vpnuser" --password "vpnpass" --encrypt | |
# configuration | |
# -> /etc/ppp/peers/vpn | |
# -> /etc/ppp/chap-secrets | |
# connection | |
sudo pppd call vpn updetach |
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/env Rscript | |
load_pkgs <- function(pkgs, repos = 'http://cran.rstudio.com/') { | |
update.packages(checkBuilt = TRUE, ask = FALSE, repos = repos) | |
sapply(pkgs, | |
function(p) { | |
if (! p %in% installed.packages()[,1]) install.packages(p, dependencies = TRUE, repos = repos) | |
require(p, character.only = TRUE) | |
}) | |
} |
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/env Rscript | |
# fisher test on each row | |
row_fisher <- function(row, alt = 'two.sided', cnf = 0.95) { | |
f <- fisher.test(matrix(row, nrow = 2), alternative = alt, conf.level = cnf) | |
return(c(row, | |
p_val = f$p.value, | |
or = f$estimate[[1]], | |
or_ll = f$conf.int[1], | |
or_ul = f$conf.int[2])) |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Accordion</title> | |
<meta name="author" content="d4i"/> | |
<style> | |
.accordion { | |
list-style: none; | |
} |
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
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>D3 Word Clouds</title> | |
<meta name="author" content="d4i"/> | |
</head> | |
<body> | |
<script src="https://rawgit.com/mbostock/d3/master/d3.min.js"></script> | |
<script src="https://rawgit.com/jasondavies/d3-cloud/master/d3.layout.cloud.js"></script> |
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/env Rscript | |
sapply(c('data.table', 'ggplot2'), function(p) require(p, character.only = TRUE)) | |
or_ci <- fread('odds_ratio.csv') | |
forest <- ggplot(or_ci, aes(x = group, y = odds_ratio, ymin = ci_lower, ymax = ci_upper, colour = class)) + | |
geom_hline(aes(yintercept = 1), colour = '#4400FF', linetype = 2) + | |
geom_pointrange(size = 0.7, shape = 15) + | |
scale_y_log10(limits = c(0.01, 100), breaks = c(0.1, 1, 10)) + |
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/env Rscript | |
sapply(c('data.table', 'ggplot2'), function(p) require(p, character.only = TRUE)) | |
mtx <- fread('matrix.csv') | |
heatmap <- ggplot(mtx, aes(x = col, y = row, fill = val)) + | |
geom_tile() + | |
scale_fill_gradient(trans = 'log', breaks = c(10, 100, 1000), low = 'grey', high = 'blue') + | |
labs(x = 'col', y = 'row') |
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/env Rscript | |
# Diabetes survey on Pima Indians | |
# | |
# variables: | |
# 'glucose' Plasma glucose concentration at 2 hours in an oral glucose tolerance test | |
# 'diabetes' Diabetes pedigree function | |
# 'test' test whether the patient shows signs of diabetes (coded 0 if negative, 1 if positive) | |
data(pima, package = 'faraway') |
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/env Rscript | |
sapply(c('dplyr', 'data.table', 'MASS', 'MCMCpack'), function(p) require(p, character.only = TRUE)) | |
# Biopsy Data on Breast Cancer Patients | |
# | |
# variables: | |
# 'V1' clump thickness. | |
# 'V4' marginal adhesion. | |
# 'class' "benign" or "malignant". |
OlderNewer