Skip to content

Instantly share code, notes, and snippets.

@jstults
jstults / integrate_fs3.py
Created February 26, 2012 22:02
Square Root Map for Falkner-Skan
import scipy as sp
from scipy.integrate import ode
from scipy.optimize import fsolve
from matplotlib import rc
rc('text', usetex=True)
tick_size = 'large'
label_size = 'xx-large'
rc('xtick', labelsize=8)
rc('ytick', labelsize=8)
rc('legend', fontsize=12)
@jstults
jstults / sketch_mar17a.pde
Created March 18, 2012 14:38
Sampling Arduino Pins Quickly
/*
Sampling with the Arduino
based on examples from
http://sites.goggle.com/site/MeasuringStuff
*/
#define FASTADC 1
// defines for setting and clearing register bits
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
@jstults
jstults / os_stats.R
Created June 2, 2012 18:54
simple time-series analysis of android market share data
#
# do some simple time series analysis on smartphone os data
# data: http://www.catb.org/esr/comscore/
# commentary: http://esr.ibiblio.org/?p=4368
#
# this file has the market share percentages table
osdata = t(read.csv("os_stats.csv",header=TRUE,row.names=1))
# this file has the raw userbase in millions
osdata2 = t(read.csv("os_stats_2.csv",header=TRUE,row.names=1))
@jstults
jstults / basis_exp_dx.R
Created July 5, 2012 00:06
example 2D experimental designs using AlgDesign library
#
# experimental designs using different basis
#
library(AlgDesign)
# generate a full factorial combination of factor levels
candidates = gen.factorial(levels=c(51,51), nVars=2, center=TRUE, varNames=c("X1","X2"))
cand.2 = gen.factorial(levels=c(7,7), nVars=2, center=TRUE, varNames=c("X1","X2"))
# add columns for the orthogonal basis
candidates = transform(candidates, X1.p = poly(candidates$X1, degree=6), X2.p = poly(candidates$X2, degree=6))
@jstults
jstults / polywell_sym.R
Created July 28, 2012 13:45
example of a test design and mixed effect analysis for measuring polywell performance and characterizing symmetry
# file: polywell_sym.R
# example of a test design and mixed effect analysis for measuring
# polywell performance and characterizing symmetry
# author: Josh Stults, www.variousconsequences.com
# date: 28 July 2012
# see also:
# http://prometheusfusionperfection.com/2012/07/27/symmetry-test/
# http://cran.r-project.org/web/packages/AlgDesign/index.html
# www.stat.wisc.edu/~bates/IMPS2008/lme4D.pdf
@jstults
jstults / idopt.R
Created August 18, 2012 17:24
comparison of D- and I-optimal samples for a 6th order 2D response surface
# compare point distributions for I and D optimal designs
# file: idopt.R
#
rm(list=ls())
library(pwr)
library(AlgDesign)
library(xtable)
dice = data.frame(var=c("x","y"), low=c(-1,-1), high=c(1,1), center=c(0,0), nLevels=111, round=4, factor=FALSE)
Ispace = gen.factorial(levels=c(111,111),nVars=2,center=TRUE,varNames=c("x","y"))/55
@jstults
jstults / gist:3853261
Created October 8, 2012 15:59
gce_setup
Authentication successful.
+-----------------------------------------+-------------------------+
| property | value |
+-----------------------------------------+-------------------------+
| name | varconcfd |
| description | |
| creation time | 2012-10-08T15:48:04.889 |
| ips | |
| INSTANCES quota usage / limit | 0.0 / 8.0 |
| CPUS quota usage / limit | 0.0 / 8.0 |
@jstults
jstults / gist:3853337
Created October 8, 2012 16:12
gce_first_instance
+------------------------+-----------------------------------------------+
| property | value |
+------------------------+-----------------------------------------------+
| name | my-first-instance |
| description | |
| creation time | 2012-10-08T16:10:29.342 |
| machine | n1-standard-1 |
| image | projects/google/images/ubuntu-12-04-v20120912 |
| zone | us-central1-a |
| tags | |
@jstults
jstults / gist:3853492
Created October 8, 2012 16:40
Ubuntu OpenFoam Config
VERS=$(lsb_release -cs)
sudo sh -c "echo deb http://www.openfoam.org/download/ubuntu $VERS main > /etc/apt/sources.list.d/openfoam.list"
apt-get update
apt-get install openfoam211 paraviewopenfoam3120
@jstults
jstults / gist:3853656
Created October 8, 2012 17:09
openFoam configuration test
$ icoFoam -help
Usage: icoFoam [OPTIONS]
options:
-case <dir> specify alternate case directory, default is the cwd
-noFunctionObjects
do not execute functionObjects
-parallel run in parallel
-roots <(dir1 .. dirN)>
slave root directories for distributed running