Skip to content

Instantly share code, notes, and snippets.

Developing BW film

  • Paterson tank
  • 10 oz (300 ml) per roll
  1. Developer
  • Varying times; see Massive Dev Chart
  • Agitate for 30 sec
  • Put tank down sharply to pop bubbles
  • Agitate 10 sec every 60 sec
cart2sph <- function (x, y, z, x0 = 0, y0 = 0, z0 = 0, units = "rad") {
# See http://mathworld.wolfram.com/SphericalCoordinates.html and https://en.wikipedia.org/wiki/Spherical_coordinate_system
# Use ISO convention
# rho = radial distance
# theta = polar angle (inclination); default units is radians
# phi = azimuthal angle; default units is radians
x <- x - x0
y <- y - y0
z <- z - z0
rho <- sqrt(x^2 + y^2 + z^2)
clearscreen
forever [
repeat 50 [setpencolor "blue left 1 forward 3]
repeat 50 [setpencolor "red left 1 forward 3]
left 122
]
cs setpencolor
forever [forward 90 left 225 forward 90 right]
@benjamin-chan
benjamin-chan / altitudeTrainingComparison.Rmd
Last active December 15, 2016 05:47
Compare Strava segment times
My results [Marquam + Flicker trail](https://www.strava.com/segments/6786353?filter=my_results).
Only use data from 2015-2016.
2016 is after altitude room training at [Evolution Healthcare and Fitness](http://www.evolutionhealthcareandfitness.com/altitude-room/).
Load data.
```{r, warning = FALSE, message = FALSE}
library(dplyr)
library(magrittr)
library(ggplot2)
@benjamin-chan
benjamin-chan / initializeProject.md
Last active September 14, 2016 23:52
Checklist of tasks to initialize a project

Checklist of tasks to initialize a project

  1. Initialize Git repo
  2. Populate README
  3. Make project folder/directory tree
  1. Update .gitignore
@benjamin-chan
benjamin-chan / makeProjectFolderTree.sh
Last active October 25, 2016 22:03
Make project folder tree (bash)
#!/bin/bash
# Do this after initializing the Git repo
mkdir background
mkdir data
mkdir data/raw
mkdir data/processed
mkdir docs
mkdir figures
mkdir lib
mkdir scripts
@benjamin-chan
benjamin-chan / makeProjectFolderTree.bat
Last active September 14, 2016 16:56
Make project subfolder tree (Windows)
rem Do this after initializing the Git repo
mkdir background
mkdir data
mkdir data\raw
mkdir data\processed
mkdir docs
mkdir figures
mkdir lib
mkdir lib\R
mkdir lib\tests
@benjamin-chan
benjamin-chan / make.R
Last active August 24, 2016 19:58
Template for R make file
setwd("H:/Projects") # Set project directory
Sys.time0 <- Sys.time()
sink("make.log")
files <- c("file1.Rmd", # File 1
"file2.Rmd", # File 2
"file3.Rmd") # File 3
@benjamin-chan
benjamin-chan / installMarkDoc.do
Last active August 11, 2016 18:02
Set up and install MarkDoc for Stata
/* See http://www.haghish.com/statistics/stata-blog/reproducible-research/markdoc.php */
ssc install markdoc /* installing MarkDoc package */
ssc install weaver /* installing Weaver package */
ssc install statax /* installing Statax package */
markdoc smclfile, replace install export(docx) /* exporting Microsoft Office Docx word */
markdoc adofile, replace install export(sthlp)/* exporting sthlp Stata help file */
@benjamin-chan
benjamin-chan / getSynPUF.R
Last active July 29, 2016 21:25
Download CMS 2008-2010 Data Entrepreneurs' Synthetic Public Use File (DE-SynPUF)
getSynPUF <- function (zipFile) {
# [CMS 2008-2010 Data Entrepreneurs' Synthetic Public Use File (DE-SynPUF)](https://www.cms.gov/Research-Statistics-Data-and-Systems/Downloadable-Public-Use-Files/SynPUFs/DE_Syn_PUF.html)
#
# Examples:
#
# > getSynPUF("DE1_0_2008_to_2010_Carrier_Claims_Sample_1A.zip")
# > getSynPUF("DE1_0_2008_to_2010_Carrier_Claims_Sample_1B.zip")
# > getSynPUF("DE1_0_2010_Beneficiary_Summary_File_Sample_1.zip")
#
require(readr)