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 / nm.tmLanguage
Created December 7, 2016 23:04
nonmem syntax highlighter
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>mod</string>
<string>ctl</string>
<string>lst</string>
</array>
@dpastoor
dpastoor / rscratch.r
Created January 11, 2017 21:19
hacky example of calling rscript from exec
args <- commandArgs(trailingOnly = TRUE)
# just add the two args goether
Input <- as.numeric(args[1]) + as.numeric(args[2])
jsonlite::toJSON(list(res = Input))
@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>
@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"
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))
if n == 0 && i == "~" {
if runtime.GOOS == "windows" {
i = os.Getenv("USERPROFILE")
} else {
i = os.Getenv("HOME")
}
}
@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
@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"
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) {
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 {