Skip to content

Instantly share code, notes, and snippets.

View dpastoor's full-sized avatar

Devin Pastoor dpastoor

  • A2-Ai
  • Rockville, MD
View GitHub Profile
@dpastoor
dpastoor / download.go
Created June 18, 2017 12:39
download file go
func downloadFile(filepath string, url string) (err error) {
// Create the file
out, err := os.Create(filepath)
if err != nil {
return err
}
defer out.Close()
// Get the data
@dpastoor
dpastoor / blueprint.Rmd
Created May 9, 2017 19:26
model blueprints
## Create a model blueprint, using a consistent API across modeling platforms.
```{r}
blueprint <- make_blueprint("nonmem")
```
```{r}
one_cmt <- blueprint %>%
ode_model(cmt = 1, depot = 1) %>%
func TestCreateDatabase(t *testing.T) {
tmpFile, err := ioutil.TempFile(os.TempDir(), "cayley_test")
if err != nil {
t.Fatalf("Could not create working directory: %v", err)
}
t.Log(tmpFile)
err = createNewBolt(tmpFile.Name(), nil)
if err != nil {
library(tidyverse)
library(future)
library(PKPDmisc)
huge_df <- map_df(1:100000, ~ Theoph %>% mutate(REP = .x))
pryr::object_size(huge_df)
parallelization_benchmark <- lapply(seq(2, 64, 2), function(ncore) {
@dpastoor
dpastoor / vanco.toml
Last active March 26, 2017 14:55
model definition first cut
[details]
name = "vancomycin"
description = "vancomycin model in neonates"
version = "0.0.1"
keywords = [
"vancomycin",
"neonates",
"pediatrics"
]
language = "R"
@dpastoor
dpastoor / ode_test1.jl
Last active March 16, 2017 23:31
ode tests in julia
using DifferentialEquations
using ParameterizedFunctions
using DataFrames
type OneCmtOral{T} <: DEDataArray{T}
x::Array{T,1}
KA::T
CL::T
V::T
if n == 0 && i == "~" {
if runtime.GOOS == "windows" {
i = os.Getenv("USERPROFILE")
} else {
i = os.Getenv("HOME")
}
}
Reproducible example:
code:
```
library(tidyverse)
df <- tibble::data_frame(ID = rep(c("A", "B"), each = 5), TIME = hms::hms(hours = 1:10),
some_na = c(1, NA, 3:10))
@dpastoor
dpastoor / .tmux.conf
Created February 4, 2017 22:05
example tmux configs
# from https://github.com/common-nighthawk/vim/blob/master/.tmux.conf
unbind C-b
set -g prefix C-a
# TRYING THINGS FROM BOOK
setw -g mode-keys vi
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection
set-option -g default-command "reattach-to-user-namespace -l fish"
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy" \; display "Copied to system from tmux clipboard"
@dpastoor
dpastoor / chain_info.R
Last active January 16, 2017 18:08
chunked processing to optimize the number of future threads spawned
library(stringr)
library(tibble)
library(tidyverse)
# subdirectories in rundir_001 each contain a fort.50 file that should be read in, thinned, and saved to satchel with additional
# information about the run appended to each chain's output
dirs <- list.dirs("../modeling/rundir_001/", recursive = F)
# match runs such as run008c1_est_01 as chain runs correspond to run<x>c<y>