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
# https://tonybreyal.wordpress.com/2011/11/24/source_https-sourcing-an-r-script-from-github/ | |
source_https <- function(url, ...) { | |
# load package | |
require(RCurl) | |
# parse and evaluate each .R script | |
sapply(c(url, ...), function(u) { | |
eval(parse(text = getURL(u, followlocation = TRUE, cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))), envir = .GlobalEnv) | |
}) |
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 json | |
import sys | |
print sys.argv[1] | |
f = open(sys.argv[1],'r') | |
arr=[] | |
headers = [] | |
for header in f.readline().split(','): |
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
indigo@indigonet:~/Downloads/toFlash$ sudo ./flashall.sh | |
[sudo] password for indigo: | |
Using U-Boot target: edison-blankcdc | |
Now waiting for dfu device 8087:0a99 | |
Please plug and reboot the board | |
Flashing IFWI | |
##################################################] finished! | |
##################################################] finished! | |
Flashing U-Boot | |
##################################################] finished! |
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
--- flashall.sh | |
+++ (clipboard) | |
@@ -220,15 +220,14 @@ | |
flash-command --alt u-boot-env0 -D "${VARIANT_FILE}" | |
echo "Flashing U-Boot Environment Backup" | |
- flash-command --alt u-boot-env1 -D "${VARIANT_FILE}" -R | |
+ flash-command --alt u-boot-env1 -D "${VARIANT_FILE}" | |
echo "Rebooting to apply partition changes" | |
- dfu-wait no-prompt |
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
[Tail end of editing /etc/network/interfaces..] | |
Get:100 http://http.debian.net wheezy-backports/main 2015-06-17-0848.19.pdiff [486 B] | |
Get:101 http://http.debian.net wheezy-backports/main 2015-06-17-0848.19.pdiff [486 B] | |
Get:102 http://http.debian.net wheezy-backports/main 2015-06-22-1436.25.pdiff [103 B] | |
Get:103 http://http.debian.net wheezy-backports/main 2015-06-22-1436.25.pdiff [103 B] | |
Get:104 http://http.debian.net wheezy-backports/main 2015-06-30-1442.21.pdiff [956 B] | |
Get:105 http://http.debian.net wheezy-backports/main 2015-06-30-1442.21.pdiff [956 B] | |
Get:106 http://http.debian.net wheezy-backports/main 2015-07-01-2039.58.pdiff [31 B] | |
Get:107 http://http.debian.net wheezy-backports/main 2015-07-01-2039.58.pdiff [31 B] |
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
require(raster) | |
require(ggplot2) | |
pulsar = function(n){ | |
x = seq(0,100, length=n) | |
norms = dnorm(x, mean=40, sd=6)*100 + dnorm(x, mean=60, sd=6)*50 | |
noise1 = approx(sample(c(rep(0:8,2),18:19)), n = n, y=NULL)$y | |
noise2 = approx(sample(0:50), n = n, y=NULL)$y | |
noise3 = rnorm(n) | |
abs(norms + norms * noise1 + norms * noise2 * .1 + noise3) |
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
// Source: | |
// https://mbostock.github.io/protovis/ex/dymax.js | |
// https://mbostock.github.io/protovis/ex/dymax.html | |
/************************************************************************/ | |
/* NOTE: in C, array indexing starts with element zero(0). I choose */ | |
/* to start my array indexing with elemennt one(1) so all arrays */ | |
/* are defined one element longer than they need to be. */ | |
/************************************************************************/ |
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
require(rgeos) | |
require(rgdal) | |
grid_lines = function(x, y, crs='+proj=longlat +datum=WGS84'){ | |
x1 = round(seq(min(x),max(x),length.out=50),3) | |
y1 = round(seq(min(y),max(y),length.out=50),3) | |
str = character(0) | |
for(i in x) for(j in 2:length(y1)) str = c(str, paste(i, y1[j], ',', i, y1[j-1])) | |
for(i in y) for(j in 2:length(x1)) str = c(str, paste(x1[j], i, ',', x1[j-1], i)) | |
grid = readWKT(paste('MULTILINESTRING((', paste(str, collapse='),('), '))')) |
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
require(raster) | |
project_tpe = function(d, x=0, y=0){ | |
d = data.frame(t(as.matrix(extent(d)))) | |
dy = mean(d$y) | |
CRS(paste0("+proj=tpeqd +lat_1=", dy, " +lon_1=", d$x[1], | |
" +lat_2=", dy, " +lon_2=", d$x[2], " +x_0=", x, " +y_0=", y, | |
" +ellps=WGS84 +datum=WGS84 +units=m +no_defs")) | |
} |
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
require(geosphere) | |
get_areas = function(spdf){ | |
polys = lapply(spdf@polygons, function(p) p@Polygons) | |
sapply(polys, function(p){ | |
coords = lapply(p, function(p) p@coords) | |
ind_areas = lapply(coords, areaPolygon) | |
sum(unlist(ind_areas)) | |
}) | |
} |