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
import pandas as pd | |
## dummy covariance matrix | |
cov = eye(2) + -.7 | |
fill_diagonal(cov, 1) | |
# a little bit of non correalted random variates | |
# also sometimes called the marginal distributions | |
n = 10000 |
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
value Latitude Longitude | |
0.7535 49.3387 -124.3272 | |
0.7332 49.3387 -123.9939 | |
0.3963 49.3387 -123.6606 | |
0.1155 49.3387 -123.3272 | |
0.2775 49.3387 -122.9939 | |
0.3157 49.3387 -122.6606 | |
0.4015 49.3387 -122.3272 | |
0.3987 49.3387 -121.9939 | |
0.7647 49.3387 -121.6606 |
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
## read in the training data | |
## more lines than it should be because of the https requirement in Github | |
temporaryFile <- tempfile() | |
download.file("https://raw.github.com/gist/2061284/44a4dc9b304249e7ab3add86bc245b6be64d2cdd/problem.csv",destfile=temporaryFile, method="curl") | |
series <- read.csv(temporaryFile) | |
## munge the data to create a frequency table | |
freqTable <- as.data.frame( t(apply(series[,1:4], 1, function(X) table(c(X, 0:9))-1)) ) | |
names(freqTable) <- c("zero","one","two","three","four","five","six","seven","eight","nine") |
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
> install.packages("sde", lib=libPath) | |
also installing the dependencies ‘fda’, ‘zoo’ | |
trying URL 'http://cran.r-project.org/src/contrib/fda_2.2.6.tar.gz' | |
Content type 'application/x-gzip' length 6356938 bytes (6.1 Mb) | |
opened URL | |
================================================== | |
downloaded 6.1 Mb | |
trying URL 'http://cran.r-project.org/src/contrib/zoo_1.6-5.tar.gz' |
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
ip2Int <- function(ip){ | |
split <- as.numeric(strsplit(ip, "\\.")[[1]]) | |
out <- (split[1] * 256^3) + (split[2] * 256^2) + (split[3] * 256) + (split[4]) | |
return(out) | |
} | |
int2Ip <- function(int){ | |
split <- NULL | |
split[1] <- as.integer(int/256^3) |
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
structure(list(CITY = c("Anqing", "Anqing", "Anqing", "Anqing", | |
"Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", | |
"Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", | |
"Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", | |
"Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", | |
"Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", | |
"Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", | |
"Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", | |
"Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", | |
"Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", "Anqing", |
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
#!/bin/bash | |
secGroup="sg-50681d39" | |
ami="ami-1aad5273" | |
keyName="ec2ApiTools" | |
keyLocation="/home/jal/Documents/AWS/ec2ApiTools_rsa_id" | |
instance_id=$(ec2-run-instances -k $keyName -g $secGroup -t m1.large $ami | awk '/INSTANCE/{print $2}') | |
echo $instance_id |
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
## Joshua Ulrich's pivot function | |
## This code is alpha and is in development. | |
## please test all results to ensure accuracy | |
pivot <- function(x, rows, cols, FUN=NULL) { | |
clean <- function(xx, dd) { | |
cd <- merge(dd,xx,by=0,all=TRUE) | |
rownames(cd) <- cd$Row.names | |
cd$Row.names <- NULL | |
return(cd) |
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
# initialize an output data frame | |
# with the right columns... I'll assume it's called dfOut | |
for ( i in 1:(nrow(df)) ) { | |
for ( j in 1:(df$endYear - df$startYear + 1 ) ) { | |
dfOut[length(dfOut +1), ] <- ## construct a single row data frame here with the write stuff and it will insert into dfOut ## | |
} | |
} |
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
#!/bin/sh | |
# | |
# Detect displays and move panels to the primary display | |
# | |
#15 second pause | |
sleep 15 | |
PYTHON=python2.6 | |
DISPER=/usr/bin/disper |